119k views
4 votes
C++ 3.4.4: If-else statement: Print senior citizen. Write an if-else statement that checks patronAge. If 55 or greater, print "Senior citizen", otherwise print "Not senior citizen" (without quotes). End with newline.

1 Answer

4 votes

Answer:

#include <iostream>

using namespace std;

int main()

{

int patronAge = 71;

if(patronAge >=55)

cout<<"Senior citizen"<<endl;

else

cout<<"Not senior citizen"<<endl;

return 0;

}

Step-by-step explanation:

Initialize the patronAge age, in this case set it to 71

Check the patronAge. If it is greater than or equal to print "Senior citizen". Otherwise, print "Not senior citizen". Use "endl" at the end of each print statement to have new lines.

User Steven Black
by
5.7k points