So this is practice code using if statements and such. My teacher now wants me to switch the int out for Chars that represent Grades A-F, Ive tried using char to do Grade = A and such but all I get are errors and uninitialized variables. Can anyone help me use the right expression?
[CODE]
int main()
{
int score = 0;
cout << "Enter your score " << endl;
cin >> score;
if (score > 89)
{
cout << "You got an A" << endl;
}
else if (score > 79)
{
cout << "You got a B" << endl;
}
else if (score > 69)
{
cout << "You got a C " << endl;
}
else if (score > 59)
{
cout << "You got a D " << endl;
}
else
{
cout << "You are failing " << endl;
}
If you showed us the code you were trying to compile that doesn't compile, we would be able to tell you exactly why it didn't compile, which would be more informative for you to learn from.
But to use chars here, you'd declare a variable like: char letter_grade;