You've got an extra } at then end ofsolve, right before check.
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
plz tell me what is wrong in program
Dave Sinula gave you the short answer. In addition I'd list these.
1) Because you aren't sure where the problem is I suspect you may well have written the entire program and then compiled it/ran it. Instead write, compile, test each section of the code as you go. It will save lots of grief along the way.
2) If you are using C, then don't include the iostream.h header.
3) Giving main() a return type of void may work on your compiler, but it is non-standard and may not work on most compilers. Unless your instructor or your employer has told you you must give main() a return value of typee void always give it a return value of type int.
4) Your indentation and placement of brackets style could be better. That's why you weren't able to pick up the error Dave Sinkula pointed out.
5) In solve(), when will n ever be less than zero?
6) In solve(), what's the upper limit of n? If n becomes greater than 99 what will happen to your code?
7) In solve(), how many levels of recursion do you think it will take to solve the problem? Given that each level of recursion is going to set aside memory for 200 ints you will likely run out of room on the stack quite quickly. Can you think of a way to allow increased levels of recursion without changing much of your code?
8) Judicious use of comments will be a godsend to you one day, and will be a godsend for those trying to help you today. If you don't know how to comment with judgement, then overcommenting is better than undercommenting in my opinion.
There may well be others as well, but this should do for a start.
Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396
Wow! It's amazing to see how many views a two year old thread has gotten. I'da ne'r thunk it.
Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396
please send me a sudoku source code in c++
- You just bumped 4 years old thread
- You ignored our rules and announcements like We only give homework help to those who show effort
- If you still interested in participating you better open new thread, explain properly what is your problem and do not forget to include a code you made so far.
- Thread closed!
peter_budo
Code tags enforcer
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902