I don't understand looping the if statements or why my program isn't working properly. The program is suppose to mirror your grade depending on your input. Does anyone see why it's not working?
#include <iostream>
using namespace std;
int main()
{
int grade;
cout << "What grade did you earn in Programming I ?" << endl;
cin >> grade;
if (grade = 'A')
cout << "an A - excellent work !" << endl;
if (grade = 'B')
cout << "you got a B - good job" << endl;
else if (grade = 'C')
cout << "earning a C is satisfactory" << endl;
else if (grade ='D')
cout << "while D is passing, there is a problem" << endl;
else if (grade = 'F')
cout << "you failed - better luck next time" << endl;
else
cout << "You did not enter an A,B,C,D or F" << endl;
return 0;
}
Aucun commentaire:
Enregistrer un commentaire