Highscore SDL
|
Just made something to keep track of highscores. It remembers only three values. First it tells the player in the console which score he got. Then I read from the text file which the previous scores are in, then I compare the current score with these. If it’s higher than any of them it is pushbacked into a vector together with them (if it’s the highest of all of them it is written in the console that you’ve got the highscore). The vector is then sorted depending on score value, after that it’s three highest values are assigned to an array that rewrites the previous textfile’s scores and outputs the order of the three best scores in the console. That’s my scores forya! |