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.
#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;
}
Comments
Leave a comment