full function:
void finalScoreMessage(bool prematureExit) {
if (finalPoints_ > highestScore_) {
cout << "You've beaten your previous high score! The new high score is: " << finalPoints_ << endl;
saveScore();
} else if (finalPoints_ <= highestScore_){
cout << "Your score is: " + finalPoints_ << endl;
cout << "Your highest score is: " + highestScore_ << endl;
}
if (prematureExit) {
cout << "\n\nSee yah later! (Press any key to exit)" << endl;
cout << "-----------------------------------------------------------------";
cin.get();
} else {
cout << "\n\nPlay again? (Answer with 'Y' to play again)" << endl;
char answer[4];
cin.getline(answer, 4);
// Play again
if (_stricmp("Y", answer) == 0) {
finalPoints_ = 0;
pointsRemain_ = 0;
numTimesPlayed_ = 0;
guessGame(5);
} else {
cout << "\n\nSee yah later! (Press any key to exit)" << endl;
cout << "-----------------------------------------------------------------";
cin.get();
}
}
}
Here's where the problem lies:
if (finalPoints_ > highestScore_) {
// Reads this just fine when the criteria is met,
cout << "You've beaten your previous high score! The new high score is: " << finalPoints_ << endl;
saveScore();
} else {
// For some reason, when it reads into here, it just outputs this: "-----------------------------------------------------"
cout << "Your score is: " + finalPoints_ << endl;
cout << "Your highest score is: " + highestScore_ << endl;
}
what the heck is going on?
Whoa. The weird output changes depending on how many times you continue the game. I'm completely lost. Uploading a .zip of the code. Maybe one you you guru's can spot the problem.