Click here to Skip to main content
15,892,575 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I have written a Sudoku solver using Microsoft Visual C++ 2010 Express. Currently, I use only C syntax. The application can accept character input from the keyboard, or read a Notepad file, in order to input the initial puzzle. As cells are solved, the 81 cells of the updated puzzle are written to the screen in a 3x3 grid of boxes having a 3x3 grid of cells in each box. Keyboard input is needed in order to continue. At this point, my application is able to solve even "very hard" puzzles. At my age, 74, that's as far as my interest goes.
I want to add an interface that uses a window that displays the grid. I want to be able to select cells in the grid and enter the starting numbers, correcting when necessary. I want to be able to display the updated puzzle as cells are solved. I also want to display the possible options for the unsolved cells, using a smaller, different colored font. These numbers are available, and displaying them in the cells of a puzzle grid would be much better than printing then in a line on the screen.
So, I need to know what .h file to include in order to use the various window functions (create, extract data, update data, etc.) that I will need. I know next to nothing about C++, but I'm sure there are procedures that make windows, size them, put data in them, read data from them, keep track of where the cursor is, and so on. If you can help me with any of the above, I would be greately appreciated.
Posted
Comments
Homero Rivera 26-Sep-15 23:11pm    
This seems like a very reasonable request, just to get the class libraries and all of that.

What software are you using to build this?
Member 12013938 27-Sep-15 0:39am    
The answer to your reply question is the first two sentences of my original question. My PC desktop application is written in C. I'm using Microsoft Visual C++ 2010 Express as my development tool (editor, compiler, debugger).
Homero Rivera 27-Sep-15 0:44am    
Right! Sorry, I overlooked that. So, are you developing as a console application for now? do you use basic printf or Console.WriteLine with the help of the .Net framework?
Member 12013938 27-Sep-15 1:31am    
Console application. I use fprintf to write to the screen. I've avoided .net framework like the plague. On the job, I coded in C and assembler, but ever since I retired, I just program in C for fun. I hope the fact that my Sudoku solver is a console application won't complicate what I want to do.
Homero Rivera 27-Sep-15 1:43am    
The main .h file is <windows.h>
However, it may be deprecated for latest versions.
Here's a good link for Windows development in the C language http://www.cprogramming.com/tutorial/opengl_first_windows_app.html

1 solution

You will need to switch from a Console application to a Windows one in order to make use of these features. Unfortunately, Windows programming is a bit of a learning curve so it may take some time. There are a number of websites around with some reasonable tutorials to help you, and I recommend http://www.winprog.org/[^] and http://www.functionx.com/win32/index.htm[^].
 
Share this answer
 
Comments
CPallini 27-Sep-15 11:22am    
5.
Member 12013938 27-Sep-15 15:15pm    
5 is in fact, my favorite number. May 5th is my birthday, and I was born in '41 (4+1 = 5). In a non-leap year, May 5th is the 125th day of the year (125 = 5x5x5). :)
Member 12013938 27-Sep-15 15:46pm    
For Richard MacCutchan: Richard, do you know whether or not I can change my console application to a Windows application by using Microsoft Visual C++ 2010 Express? I assume I'd have to modify all my i/o commands accordingly, but I wonder if the remainder of my C code would be salvageable. There's lots of it, and if the task of converting it to some form of C that's Windows-specific is a monumental one, I'll just continue doing things the way I have been. I was hoping there was a not-too-involved way to add a GUI to my Sudoku solver.
Member 12013938 27-Sep-15 19:57pm    
Thanks to all who responded to my question. Rather than modifying my console operation, I thought about doing the following, which will accomplish most of what I want to do. Now I'm thinking that I just want a window application that will accept numbers entered into the cells of a 9x9 grid in the window and then write the numbers into an output .txt file. My existing console application could then work as usual, without making any changes except for the file name of the input .txt file. So, now all I need is to write a window application that utilizes a 9x9 grid and transfers the input to an output .txt file. Any help you can provide would be greatly appreciated.
Richard MacCutchan 28-Sep-15 3:37am    
Firstly, writing Windows programs using C and Visual Studio Express is a simple job, I do it all the time. The non-simple part is learning Windows programming in the first place, hence my links above.
Secondly your suggestion of a Windows and Console app working together is a bit pointless. If you are going to write some part of the app as a Windows program then you may as well do it all that way. Adding the logic from the existing application should not be too much of a problem.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900