| | |
sudoku program 3x3 only
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
You need to turn the computer off and think about how to solve the problem before you confuse yourself with any more code. There is too much of it.
Here are some hints.
Each one of those hints suggests a function to test a given number:
Don't if..else every possible combination. There are too many. Use your procedures in an algorithm to test numbers until you can find a valid match or potential match.
I suspect your teacher will expect you to use some recursion to solve this problem. (If you are just doing this on your own, then I suggest you use some recursion to solve this problem.)
Hope this helps.
Here are some hints.
- A 3x3 grid can be solved by placing the numbers 1 through 9 in it in any order.
So long as there are no duplicates and the grid is completely filled, it is solved. - A specific row of the 3x3 grid can have up to six numbers excluded from it.
- Likewise with a column.
Each one of those hints suggests a function to test a given number:
- Is the number already in the 3x3 grid or not?
- Is the number already in the 9x1 row or not?
- Is the number already in the 1x9 column or not?
Don't if..else every possible combination. There are too many. Use your procedures in an algorithm to test numbers until you can find a valid match or potential match.
I suspect your teacher will expect you to use some recursion to solve this problem. (If you are just doing this on your own, then I suggest you use some recursion to solve this problem.)
Hope this helps.
•
•
Join Date: Mar 2008
Posts: 1,411
Reputation:
Solved Threads: 114
I cant even see the quick reply box because you posted so much code...
I need pageviews! most fun profile ever :)
I just wrote a new OS and here is the code.
[500K Lines Here]
Yeah and I forgot to add at the beginning.
[500K Lines Here]
Yeah and I forgot to add
C++ Syntax (Toggle Plain Text)
cout<<"Hello World\n";
[Catchy Signature Here]
![]() |
Similar Threads
- Help a lurker (Java)
Other Threads in the C++ Forum
- Previous Thread: C++ Stack/GeneralTree help
- Next Thread: sorting 2d array
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count data database delete deploy developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings struct temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






