168k views
0 votes
Write a cout statement that prints the value of a conditional expression. The conditional expression should determine whether the value of the score variable is equal to 100. If so, it should print “Perfect”, otherwise it should print “Nice try”.

1 Answer

7 votes

Answer:

The explanation to this question is given below in the explanation section.

Step-by-step explanation:

#include <iostream>

#include <string>

using namespace std;

int main()

{

int score;

cout << "Enter Score: \\";

cin>>score;

if (score == 100)

//whether the value of the score variable is equal to 100

{

cout << "Perfect ";

//If so, it should print “Perfect”

}

else

{

cout << "Nice Try ";

}

}

User Eickeee
by
5.1k points