I am trying to code an activity we did in class the first 3 if statements work but the last 2 shows an error statement has no effect [-Wunused-value].
#include <iostream>
#include <cmath>
using namespace std;
char getSign()
{
int grade;
char Sign;
cout << "Enter grade: ";
cin >> grade;
if(grade == 100)
{
Sign = 'A';
}
else if(grade == 95)
{
Sign = 'B';
}
else if(grade == 90)
{
Sign = 'C';
}
else if(grade == 85)
{
Sign == 'D';
}
else
{
Sign == 'F';
}
return Sign;
}
int main()
{
cout << "Your card grade is: 0" << getSign();
return 0;
}
The result is if I do enter the number 85 or any other number it show 0w
Aucun commentaire:
Enregistrer un commentaire