Keeping high score

Oct 14, 2014 at 3:18pm
Hello, I'm new to coding and I have to make a game where it has to keep the best score after playing it a couple times, how do I do this? I already have the code for the game, I just don't know what to do to make it store the best score.

Oct 14, 2014 at 4:02pm
If you need to store it between runs of the program then just write it to a file when you exit the program and read it back in when you start.
Oct 14, 2014 at 4:11pm
how do i do this? with a function?
Oct 14, 2014 at 4:18pm
Input/Output with files:
http://www.cplusplus.com/doc/tutorial/
Oct 14, 2014 at 5:06pm
no like how do i store the scores and then put out the lowest score after the user plays the game a couple times
Oct 14, 2014 at 5:49pm
use fstream. and write the score to a file then use that file as input to ask for the score and if your new score is greater than rewrite the file to store the new best score
Topic archived. No new replies allowed.