C++/C++ program
Expert: Joseph Moore - 8/25/2009
Questionhey,
am in 12th grade..we have to do this computer science project.. and i am thinking of doin an C++ program for generating sudoku and solving them too.. but b4 starting it i would like to know if there is any scope in it for using file handling and pointers in this program(because our syllabus had great focus on file handling and pointers) ..? please help me out.. and it would be great if u could give me other ideas for a project based on these concepts..
thanks :)
AnswerHi, Revathi.
Generating and solving Sudoku is a somewhat tricky prospect, just so you know. There is tons of information available on the Internet to help you, but you have to understand that, while generating a board that fits the Sudoku rules, trimming the starting information gets harder, because you must leave enough information for the problem to be solvable, but not so much that it's too easy. You also have to make sure that you haven't left more than one solution.
Also, solving a Sudoku is pretty tricky, too. There are little tricks you can use, all sorts of algorithms, and plenty of available information on the Internet, but it's still not exactly easy.
That said, if you're still willing to tackle it, there's plenty of room for pointer usage. You can use pointers in just about any program you can think of. In a Sudoku program, you can use pointers to pass the board around, individual spaces on the board, individual rows on the board, etc. Pointers are extremely useful things that you'll find yourself using all over the place.
As for file I/O, I'd say your best bet in a Sudoku generator/solver would be to save the generated Sudoku to files, both the starting board and the solved board. You could also have a section of the program that allows you to load saved boards and solve them.
The number of programs you could write that use file I/O and pointers is literally limitless. Pretty much you can just come up with something that reads in and saves files, and the data in those files will likely be store into memory with pointers referencing a class or structure or some such.
I hope my answer has helped you, and if you have further questions, please do not hesitate to ask.