943,912 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 2776
  • C++ RSS
Jun 16th, 2008
-1

sudoku program 3x3 only

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

<replaced code with attachment>
Attached Files
File Type: cpp test.cpp (23.6 KB, 255 views)
Last edited by Ancient Dragon; Jun 17th, 2008 at 8:35 am. Reason: replaced code with attachment
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
delixir is offline Offline
1 posts
since Jun 2008
Jun 16th, 2008
0

Re: sudoku program 3x3 only

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.
Featured Poster
Reputation Points: 1140
Solved Threads: 229
Postaholic
Duoas is offline Offline
2,039 posts
since Oct 2007
Jun 16th, 2008
0

Re: sudoku program 3x3 only

I cant even see the quick reply box because you posted so much code...
Reputation Points: 1429
Solved Threads: 129
Posting Virtuoso
William Hemsworth is offline Offline
1,542 posts
since Mar 2008
Jun 17th, 2008
0

Re: sudoku program 3x3 only

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

[500K Lines Here]

Yeah and I forgot to add
C++ Syntax (Toggle Plain Text)
  1. cout<<"Hello World\n";
at the beginning.
Reputation Points: 10
Solved Threads: 1
Light Poster
DigitalPackrat is offline Offline
33 posts
since Jan 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: C++ Stack/GeneralTree help
Next Thread in C++ Forum Timeline: sorting 2d array





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC