-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmilitary2.cpp
More file actions
40 lines (34 loc) · 1.05 KB
/
military2.cpp
File metadata and controls
40 lines (34 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*****************************************************
James Bertel
CS111
Lab
This program will ask the user to enter their age and gender, and it will display one of the mesages below depending on their age and gender
*****************************************************/
#include <iostream>
using namespace std;
int main()
{
//declare variables
int age;
char gen;
cout << "Please enter your gender: ";
cin >> gen;
if(gen=='m' || gen=='M')
{
cout << "Please enter your age: ";
cin >> age;
if(age < 0)
cout << "Invalid age" << endl;
else if(age <= 16)
cout << "You need to wait " << 17-age << " more years." << endl;
else if(age >= 17 && age <= 42)
cout << "The military is hiring more people like you." << endl;
else
cout << "Thank you for using the system." << endl;
}
else if(gen=='f' ||gen=='F')
cout << "Thank you for using the system, but we were only looking for men." << endl;
else //gen != m, M, f, or F
cout << "Invalid gender." << endl;
return 0;
}