sudoku program 3x3 only

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2008
Posts: 1
Reputation: delixir is an unknown quantity at this point 
Solved Threads: 0
delixir delixir is offline Offline
Newbie Poster

sudoku program 3x3 only

 
-1
  #1
Jun 16th, 2008
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>
Last edited by Ancient Dragon; Jun 17th, 2008 at 8:35 am. Reason: replaced code with attachment
Attached Files
File Type: cpp test.cpp (23.6 KB, 31 views)
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,951
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: sudoku program 3x3 only

 
0
  #2
Jun 16th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 1,411
Reputation: William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of 
Solved Threads: 114
Sponsor
William Hemsworth William Hemsworth is offline Offline
Nearly a Posting Virtuoso

Re: sudoku program 3x3 only

 
0
  #3
Jun 16th, 2008
I cant even see the quick reply box because you posted so much code...
I need pageviews! most fun profile ever :)
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 33
Reputation: DigitalPackrat is an unknown quantity at this point 
Solved Threads: 1
DigitalPackrat's Avatar
DigitalPackrat DigitalPackrat is offline Offline
Light Poster

Re: sudoku program 3x3 only

 
0
  #4
Jun 17th, 2008
I just wrote a new OS and here is the code.

[500K Lines Here]

Yeah and I forgot to add
  1. cout<<"Hello World\n";
at the beginning.
[Catchy Signature Here]
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC