Unknown error in program.

Hey, I'm new to writing c++ programs and I have run into a problem. The program is supposed to take three inputs (name, gender, grade) and the program is supposed to start the student into one of 4 classes depending on gender and grade. But my problem is that I'm being told that M/F are not declared in this scope so I don't know what to do. The errors are in the If section of the program so I would like some insight as to how I can fix this. Thank you and its much appreciated for the help.
Here is the program:


# include <iostream>
using namespace std;
int main(){
int grade;
char gender;
string name;
cout << "What is your name?";
cin >> name;
cout << "What is your gender (M or F)?";
cin >> gender;
cout << "What is your grade?";
cin >> grade;
if (((gender=M)&&(grade>=90))||((gender=F)&&(grade>=80)))
cout << name << " is in Class A." << endl;
if (((gender=M)&&(grade>=70&&grade<=90))||((gender=F)&&(grade>=70&&grade<=80)))
cout << name << "is in Class B." << endl;
if ((gender=M)&&(grade<70)) cout << name << " is in Class C." << endl;
if ((gender=F)&&(grade<70)) cout << name << " is in class D." <<endl;
return 0;
}

= is for assignment. == is for comparison.
M is an identifier. 'M' is the letter M.
Now the condition isn't going through. Is there something else that I'm missing in the program?
Last edited on
Please space out your code and place code tags around it so it is readible.
closed account (z05DSL3A)
I think this thread got reposted here:
if else statement question
http://www.cplusplus.com/forum/beginner/7797/
Topic archived. No new replies allowed.