I'm getting the following error in Visual Studio that I don't understand:
main.cpp(21): error C2440: '=': cannot convert from 'void' to 'char'
main.cpp(21): note: Expressions of type void cannot be converted to other types
This is my code:
void getLetterGrade(double totalAvg, char& letter_Grade)
{
if (totalAvg >= 90) {
letter_Grade = 'A';
}
else if (totalAvg < 90 && totalAvg >= 80) {
letter_Grade = 'B';
}
else if (totalAvg < 80 && totalAvg >= 70) {
letter_Grade = 'C';
}
else if (totalAvg < 70 && totalAvg >= 60) {
letter_Grade = 'F';
}
}
int main()
{
double totalGrade = 74;
char letterGRADE;
letterGRADE = getLetterGrade(totalGrade, letterGRADE);
}