Answer to Question #314022 in C++ for queeny wallace

Question #314022

A program stores test scores in two int variables named myScore and expectedScore. Write the C++ code to compare the two scores and then display one of the following messages: “I met my expectations”, “I scored higher than expected”, or “I scored lower than expected”.


Make use of either a While Loop, For Loop or a Do While Loop to allow the program to repeat until a sentinel value or counter is used to break out of the loop


1
Expert's answer
2022-03-18T12:13:07-0400

Here is program:

int main()
{
	int myScore;
	int expectScore;
	int score, score1;
	bool exit = false;
	while (!exit)
	{
		cin >> score;
		cin >> score1;
		if (score > score1)
		{
			cout << "“I met my expectations" << endl;
			cout << "Continue?" << endl;
			cout << "0) Continue" << endl;
			cout << "1) Exit" << endl;
			cin >> exit;
		}
		else
		{
			cout << "I scored higher than expected" << endl;
			cout << "Continue?" << endl;
			cout << "0) Continue" << endl;
			cout << "1) Exit" << endl;
			cin >> exit;
		}
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog