954,152 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

sudoku program 3x3 only

this is the working 3x3 sudoku but i still need to do 6x6 and 9x9. i need help please and suggestions.

Attachments test.cpp (23.55KB)
delixir
Newbie Poster
1 post since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

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.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.

Duoas
Postaholic
2,043 posts since Oct 2007
Reputation Points: 1,140
Solved Threads: 229
 

I cant even see the quick reply box because you posted so much code...

William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129
 

I just wrote a new OS and here is the code.

[500K Lines Here]

Yeah and I forgot to add

cout<<"Hello World\n";


at the beginning.

DigitalPackrat
Light Poster
35 posts since Jan 2008
Reputation Points: 10
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You