switch (grade)
{
case 'A':
cout << name << "your final grade is " << grade;
break;
case 'B':
cout << name << "your final grade is " << grade;
break;
case 'C':
cout << name << "your final grade is " << grade;
break;
case 'D':
cout << name << "your final grade is " << grade;
break;
case 'E':
cout << name << "your final grade is " << grade;
break;
case 'F':
cout << name << "your final grade is " << grade;
break;
case 'G':
cout << name << "your final grade is " << grade;
break;
case 'H':
cout << name << "your final grade is " << grade;
break;
case 'I':
cout << name << "your final grade is " << grade;
break;
case 'J':
cout << name << "your final grade is " << grade;
break;
default :
cout << "Undefined value! Make sure it's a value from 0-100!";
break;
}
getch ();
system("cls");
return main ();
Two things are wrong with that switch. Firstly, switch only works with integer classes (including chars which are convertible) and you are passing a float meaning the switch is invalid. You then compare this float to a char in your case statements meaning none of them would call. Also please use code tags in the future. Other things wrong with this code are return main(); which at the best of times would set up an infinite loop, but even then it is not legal C++. You also use system() functions, which are generally discouraged as is conio as it is non-standard.