Created
April 14, 2019 18:31
-
-
Save kawzar/7b60f3274e58f089ecf5c7abe2b72b9c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void GameManager::printHighscores() { | |
clrscr(); | |
gotoxy(5, 2); | |
textcolor(10); | |
cout << "GAME OVER!" << endl; | |
cout << "Score is: "<< formation->getScore(); | |
Score* highScores[5]; | |
scoreManager->getHighScores(highScores); | |
bool isHighScore = false; | |
for(int i = 0; i < 5 && !isHighScore; i++) { | |
if (highScores[i]->score <= formation->getScore()) { | |
isHighScore = true; | |
} | |
} | |
char name[30]; | |
if (isHighScore) { | |
cout << "You make it to the highscores! Please Enter your name:" << endl; | |
gets(name); | |
Score* newScore = new Score(); | |
strcpy(newScore->name, name); | |
newScore->score = formation->getScore(); | |
scoreManager->addScore(highScores, newScore, highScores); | |
} | |
scoreManager->getHighScores(highScores); | |
for (int i = 0; i < 5; i++) { | |
textcolor(i +2); | |
puts(highScores[i]->name); | |
//cout << "......" << highScores[i].score << endl; | |
} | |
getchar(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment