The issue is in the =
in if
conditions.
=
is the assignment operator whereas ==
is the equality comparision operator.
When you assign a value to the int
, it evaluates to true as well, and so the if condition is also satisfied.
Also, as mentioned in the comments, change the data type from int
to char
for grade.
0
solved c++ with the if, else if, and else statements on my program? (newbie)