You are here:

C++/C++ program

Advertisement


Question
hey,
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 :)

Answer
Hi, 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.

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Joseph Moore

Expertise

I've been programming in one form or another since my brother taught me BASIC when I was 6. I've been programing professionally since I was 20, first web development with HTML, JS, DHTML, CSS, etc., then I became a video game developer, writing code in C, C++, C#, SQL, assembly, and various scripting languages. I've even written my own scripting languages, custom designed for the games I was making. I also dabble in Java, PHP, and Perl. I've worked on pretty much every aspect of game development, including graphics, audio, gameplay, tool, UI, input, animation, and physics.

Experience

I've been writing C++ code for 12 years, both on my own in my spare time and professionally.

Organizations
IGDA

Education/Credentials
Bachelor of Science in Game Design and Development, Full Sail University, Winter Park, FL

Awards and Honors
Salutatorian and Advanced Achiever Awards at Full Sail; Independent Games Festival Student Showcase winner, 2004; Featured article on Gamasutra about an experimental game developed in 2004

©2016 About.com. All rights reserved.