I am making this program but It doesnt works properly if different values are entered
Write program which will take person’s gender, material status(in characters) and age as input and will tell that the person is eligible to get job in Departement of Defense or not.
Creiteria:
FOR MALE:
Age should be between 26-39
He can be married or single
Gender should be male
FOR FEMALE
Age should be between 20-28
She should be single
Gender should be female
INPUT:
ENTER MATERIAL STATUS:S
ENTER AGE: 28
ENTER GENDER: M
OUTPUT:
CRITERIA MET
NOTE:
1. if user enter a character for material status other of S or M and for gender other than M OR F program should give a error and teriminate.
Code:void main() { char g,ms; int age; clrscr(); if(g=='M' && g!='F' && ms!='M' || ms!='S') { cout<<"\n Gender : "; cin>>g; cout<<"\n Age : "; cin>>age; cout<<"\n Marital status : "; cin>>ms; if(g=='M' && age>=26 && age<=39) cout<<"\n Criteria Met "; else if(g=='F' && age>=20 && age<=28 && ms=='S') cout<<"\n Criteria Met "; else cout<<"\n Invalid Info "; } else if(g!='M' || g!='F' && ms!='M' || ms!='S') cout<<"\Error"; exit(0); } getch();