Age program HW help please
i came across this hw and completely stuck please help!!
it's asking to write program to display age
(int age;
int min=18;
int max =40;
if age < min -> yes -> display "too Young!"
-> No ( else) -> if age > max -> yes-- display "too old"
-> No -- display "perfect!")
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
int main()
{
int age = 0, min = 18, max = 40;
cout << "Enter your age: ";
cin >> age;
if (age < min)
{
cout << "Too young!\n";
}
else if (age > max)
{
cout << "Too old!\n";
}
else
{
cout << "Perfect!\n";
}
return 0;
}
|
Topic archived. No new replies allowed.