Public Group

Refresh c++

This topic is 4886 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hi, I have made a small game of tic tac toe which I want to refresh so it changes. How would I do this?

Share on other sites
system("cls");

but you must redraw after that because it clears the screen

Share on other sites
Thanks. Could I make it so it redraws everything itself?

Share on other sites
You want to write a function that draws your gamestate, and call that after everytime you clear the screen.

Share on other sites
Could you tell me how to write a function please?

Share on other sites
In short (I can't believe I'm doing this):

here is an example:

[/source]
void DrawTheBoard(TicTacToeBoard board)
{
system("cls");
//Do the drawing procedure here
}

int main()
{
TicTacToeBoard board;
while(game)
{
//User input stuff
DrawTheBoard(board);
}
}
If you don't know how to write a function, you really need to read up more.  Check out the GDnet store - look for books by Addison-Wesley, a publisher with a good reputation.

Share on other sites
Are you using Java or C/C++? How much programming do you know? You would just pass the information of the squares to a drawing function which would then draw the squares and mark the appropriate Xs or Os.

Share on other sites
Quote:
 Original post by YhackCould you tell me how to write a function please?

clicky

Share on other sites
Quote:
 Original post by YhackCould you tell me how to write a function please?

This question shows that you don't really know wht a C++ function is, because it shows that you didn't notice that main() is a function.

I believe you should find a small book about C or C++; you might also check the web for more information. cprogramming has rather simple C++ tutorials that might help you.

HTH,

(icks. too slow)

1. 1
Rutin
46
2. 2
3. 3
4. 4
5. 5
JoeJ
19

• 11
• 15
• 9
• 10
• 13
• Forum Statistics

• Total Topics
633004
• Total Posts
3009837
• Who's Online (See full list)

There are no registered users currently online

×