cout<<"Please enter your gender using M or F\n";
cin>>gen;
if(gen == 'M'|| gen == 'm')
{
cout<<"please enter your graduate level put P for post graduate or G for graduate\n";
cin>>grad;
}
}
NOW IF I TRY TO PUT A IF INSIDE THAT IF STATEMENT IT DOESNT SEEM TO WORK RIGHT FOR ME, i AM having the issue if getting all the way to the end level of the problem
#include<iostream>
using std::cout;
using std::cin;
using std::endl;
int main(){
char
gen,
grad;
int
salary=0,
yearsOfService;
cout<<"Please enter your gender (using M=Male,F=Female): ";
cin>>gen;
if(gen=='M'||gen=='m'){
cout<<"\nYears of service: ";
cin>>yearsOfService;
if(yearsOfService>=10){
cout<<"\nNow enter your graduate level P=post graduate G=graduate: ";
cin>>grad;
if(grad=='P'||grad=='p')
salary=15000;
else
salary=10000;
}else{
cout<<"\nNow enter your graduate level P=post graduate G=graduate: ";
cin>>grad;
if(grad=='P'||grad=='p')
salary=10000;
else
salary=7000;
}//end if else
cout<<"\nYour salary is: "<<salary<<endl;
}else{
if(gen=='F'||gen=='f'){
cout<<"\nYears of service: ";
cin>>yearsOfService;
if(yearsOfService>=10){
cout<<"\nNow enter your graduate level P=post graduate G=graduate: ";
cin>>grad;
if(grad=='P'||grad=='p')
salary=12000;
else
salary=9000;
cout<<"\nYour salary is: "<<salary<<endl;
}else{
cout<<"\nNow enter your graduate level P=post graduate G=graduate: ";
cin>>grad;
if(grad=='P'||grad=='p')
salary=10000;
else
salary=6000;
cout<<"\nYour salary is: "<<salary<<endl;
}//end if...else
}else{
cout<<"Only M,m F,f..."<<endl;
}//end if...else
}//end if...else
return 0; //indicates success
}//end main
Please enter your gender (using M=Male,F=Female): m
Years of service: 10
Now enter your graduate level P=post graduate G=graduate: p
Your salary is: 15000
Please enter your gender (using M=Male,F=Female): M
Years of service: 10
Now enter your graduate level P=post graduate G=graduate: g
Your salary is: 10000
Please enter your gender (using M=Male,F=Female): F
Years of service: 10
Now enter your graduate level P=post graduate G=graduate: P
Your salary is: 12000
Please enter your gender (using M=Male,F=Female): d
Only M,m F,f...