Answer to Question #325836 in C++ for Superman

Question #325836

write a program that prompts the user to enter the age of a customer.if the age is younger than 15 then ask the user to enter the name of the customer and notify them by name that they qualify a free toy in a if and else statement.


1
Expert's answer
2022-04-08T09:01:32-0400
#include <iostream>
#include <string>
using namespace std;

int main() {
    int age;
    string name;

    cout << "Enter your age: ";
    cin >> age;
    if (age < 15) {
        cout << "Enter yoyr name: ";
        cin >> name;
        cout << "Congrats " << name << ", you are qualifying for a free toy" << endl;
    }
    else {
        cout << "Sorry, you are too old" << 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

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS