is there any problem with my coding ......i cant compile it .

#include <iostream>
using namespace std;


int main()
{

char employed, recentGrad;

cout<<"Answer the following question with either Y for Yes or N for No."<<endl;
cout<<"Are you employed?";
cin>>employed;
cout<<"Have you graduated from college in the past 2 years?";
cin>>recentGrad;

if(employed=='Y')
{
if (recentGrad=='Y')
{
cout<<"You qualify for the special interest rate"<<endl;
}

else
{
cout<<"You must have graduated from college in the past two years to qualify."<<endl;
}

}

else
{
cout<<"You must be employed to qualify."<<endl;
}

return 0;

}
Now it works. :) Compare to see what i changed.

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
41
#include <iostream>
using namespace std;


int main()
{

char employed, recentGrad;

cout<<"Answer the following question with either Y for Yes or N for No."<<endl;
cout<<"Are you employed?";
cin>>employed;
cout<<"Have you graduated from college in the past 2 years?";
cin>>recentGrad;

if(employed=='Y' && recentGrad=='Y' )


{
cout<<"You qualify for the special interest rate"<<endl;

}

else if (employed == 'Y' && recentGrad =='N')
{
cout<<"You must have graduated from college in the past two years to qualify."<<endl;
return EXIT_SUCCESS;
system("PAUSE");
}



else 
{
cout<<"You must be employed to qualify."<<endl;

}

system("PAUSE");
return EXIT_SUCCESS;
}
your code if fine . I have checked it by copy pasting it on to my c++. It might be that your are not compiling correctly.
Topic archived. No new replies allowed.