This is my program:
There is a secret government organization called PIB which only accepts recruits who fit
their criteria (shown below). If you fit any of the combinations of criteria, then you can
apply to work for PIB. Write a program which asks the user appropriate questions (ask
all the questions up front) and then determines if the candidate is acceptable. Use the
screen shots as a guide.
Here are the rules:
• If you are male between the ages of 18 and 30 (inclusive) you may apply.
• If you are female between the ages of 18 and 32 (inclusive) you may apply.
• If you are male between the ages of 18 and 35 (inclusive) and either were in the
military or you can do at least 50 pushups in a row you may apply.
• If you are female between the ages of 18 and 40 (inclusive) and either were in the
military or you can do at least 30 pushups in a row you may apply.
• No one else is eligible.
I have this so far:
#include <iostream>
#include <string>
using namespace std;
int main ()
{
int age;
int pushups;
string name;
string gender = "m";
string answer = "yes";
while (answer == "yes")
{
cout << "What is your full name? ";
getline(cin, name);
cout << "How old are you? ";
cin >> age;
cout << "Were you ever in the military <yes/no>? ";
cin >> answer;
cout << "How many pushups can you do in a row? ";
cin >> pushups;
cout << "Are you <m>ale or <f>emale? ";
cin >> gender;
}
}
I need my program to out put the message: Yes, <name>, you may apply.....If they meet the criteria above. If they don't meet the criteria, then it needs to say "Sorry, <name>, you are not eligible."
I have been working on it all day and I can't seem to figure out a way to compare everything. It has to be in a while loop with if statements.