-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnested_if.cpp
More file actions
36 lines (31 loc) · 764 Bytes
/
nested_if.cpp
File metadata and controls
36 lines (31 loc) · 764 Bytes
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
/*
*
* Create an if statement that is nested inside another if statement
* Nested if statements can be used to test more than one condition
*
*/
#include <iostream>
using namespace std;
int main()
{
char employed;
char recentGrand;
cout << "Are your employed? Enter y for Yes and n for No: "; //Ask user for input
cin >> employed;
//cin.ingnore();
if (employed == 'y')
{
cout << "Are you a recent Grad? Please enter y(lower) for Yes and n(lower) for No: ";
cin >> recentGrand;
if (recentGrand == 'y')
{
cout << "You qualify for the special interest rate\n";
}
else
cout << "You must graduate from college in the past two years to qualify\n";
}
else
cout << "You must be employed to qualify\n";
system("pause");
return 0;
}