Hi There,
I'm a begginer in C++. In the program below the value must be returned to display the appropriate message. I expiriencing problems trying to compile the program. The erro message:
[Warning] In function `bool passOrNot(char)':
non-lvalue in assignment
Can you help. Thanks
#include <iostream>
using namespace std;
int symbol(int m)
{
{if (m > 0 && m < 40)
m = 'F';
else if (m > 39 && m < 50)
m = 'E';
else if (m > 49 && m < 60)
m = 'D';
else if (m > 59 && m < 70)
m = 'C';
else if (m > 69 && m < 80)
m = 'B';
else if (m > 79 && m < 100)
m = 'A';
}
return m;
}
bool passOrNot(char symb)
{
if (symb = 'E' || symb = 'F')
return false;
else
return true;
}
int main( )
{
int mark;
char symb;
cout << "Enter the mark out of 100: ";
cin >> mark;
symb = symbol(mark);
cout << "The symbol corresponding to " << mark << " is " << symb;
if (passOrNot(symb))
cout << ". You pass - congratulations!" << endl;
else
cout << ". Unfortunately you fail." << endl;
return 0;
}