Answer to Question #290027 in C++ for luq

Question #290027

get age

get age

if age is less than 18

 status is under age

else

 status is over age

display status


1
Expert's answer
2022-01-23T15:21:26-0500
#include <iostream>

int main()
{
    int age1 = 0;
    std::string status;
    while(age1 < 18)
    {
        std::cout<< "Enter your age: ";
        std::cin>> age1;
        if(age1 < 18)
        {
            status = "under";
        }
        else
        {
            status = "over";
        }
        std::cout<< "Status is "<<status<<" age."<<std::endl;
    }
    
    return 0;
}

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