Write a program to check if the person is eligible to go into a musical concert. For a person to be eligible, they must be over 21, and they must have a ticket. If neither condition is satisfied, the person will not be allowed in. Your program should print “Person is eligible” or “Person is not eligible”.
#include <iostream>
using namespace std;
int main()
{
int age = 0;
cout << "Enter a person age: ";
cin >> age;
cout << "Have a person ticket(Y/N)? ";
char ch;
cin >> ch;
if (age >= 21 && ch == 'Y') cout << "Person is eligible" << endl;
else cout << "Person is not eligible" << endl;
return 0;
}
Comments
Leave a comment