Highscore

Im making a game in c++, and struggling with how to write out the Highscore. I've got a variable that's counting a player's score, and when it is game over that score is written in the middle of the window. I also have a highscore section in the menu looking something like this:

Play Game
Highscores
Options
Credits
Exit

My question to you is how do I cout the score a player got in the game, when I choose Highscores in the menu? Thanks in advance!
You seem to have forgotten to tell us which library you're using OP.
Sorry Im quite new to this, what do you mean by library?
SFML, Allegro, SDL ... There are half a dozen of them and most of us haven't memorized them all. If you're doing this on the console I'd discourage that but we could still help, you would just have to mention it. In the last case you would just use std::cout to put it to the console window so I guess I don't understand the question in that case.
"hi" is the variable that's counting the score

void high()
{
if(10 == gapX1+1 || 10 == gapX2+1 || 10 == gapX3+1)
{
hi++;
}
}


In this, "runHighscores", is where I want to cout the score.

else if(val == 1)
{
runHighscores();
}
If I just use cout << hi; it wont work.

I hope this can help you understand my problem
You need to return\pass the variable into the scope that is displaying it.
Topic archived. No new replies allowed.