do not enter 20 or 40

#include <iostream>
#include <string>

using namespace std;

int main() {

int age;
string em;

cout << "Please input your age: \n";
cout << "Remember you can not enter 20 or 40 if you do it wont work sorry " << endl;
cout << "enter your age: \n";
cin >> age;
cout << "enter your name: " << endl;
cin >> em;


if (age<20){
cout << "you are just the right age " << em << endl;

}
else
{
if (age>40)
cout << "Your getting older " << em << endl;
}

system ("pause");
return 0;
}
So, do you have a question or problem, with your program? One problem I see, is the title. Actually, it won't work with any input from 20 TO 40, not 20 OR 40.
Last edited on
why cant i do the numbers 20 - 40?????
Topic archived. No new replies allowed.