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.

Recommended Answers

All 2 Replies

what the heck is going on?

cout << "Your score is: " + finalPoints_

You want to change the '+' there to something else.

commented: Nice catch! +20
cout << "Your score is: " + finalPoints_

You want to change the '+' there to something else.

LMAO!!!! Thanks so much. Darn Java got me again!

Always a good idea to have another pair of eyes on code.

Thanks again!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.