Making a grid in C++
I'm trying to make a simple grid appear in C++ Console window, so I can play a basic game of Tic-tac-toe, but I can't find a good way to create a grid, I was looking at "dataGridView" but I can't find a whole lot of support for that on C++, lots in C# though.. =P
Anyway, I thought of manually creating a grid with text, but then I got into thinking - How in the world would I put my 'X's and 'O's in certain spaces? perhaps I could shove the entire thing into an array, and just re-draw it each time, but that seems like more work than needed, it'll probably reduce efficiency as well.
Any support os welcome and apreciated very much =)
You can't use controls such as datagrid inside the console window, you will have to work with only text mode, I think one can write a pretty good logic of grid by showing " | " and "-" characters.
I didn't think you could, damn.
Hmm... Okay but that doesn't answer my question of how to enter the data into the cells with | and _'s
I can easily create that kind of grid, check it out!
__
| | | |
|_|_|_|
| | | |
|_|_|_|
| | | |
|_|_|_|
I give up. It looks good before the forums formatting gets to it. Lol.
The Midnighter wrote: |
| just re-draw it each time, but that seems like more work than needed, it'll probably reduce efficiency as well. | |
Not really. It is a good solution, at least for educational purposes.
What are the requirements for the assignment? Are you limited to use of certain things, such as the use of the C++ langauge? Can you use Windows console functions or are you restricted to the langauge standard?
See Character-Mode Applications for an alternative that uses Windows functions.
The Midnighter wrote: |
__ | | | | |_|_|_| | | | | |_|_|_| | | | | |_|_|_| I give up. It looks good before the forums formatting gets to it. Lol. | |
Perhaps the following is better.
__
| | | |
|_|_||
| | | |
|_|_||
| | | |
|_|_||
The difference is that you are using a proportional font and I am using a fixed font.