Since I can't use ranges in switch case, and since the cin input for (grade) comes before this function. Is it possible to use if else statements to automatically input the grade for the user into the switch statement? so they don't have to input their grade twice.. for example
cin >> grade;
if (grade>=90 && grade<=100)
{
grade == A
}
switch(grade){
case 'A':
{
cout << "Your Grade is an A" << endl;
break;
}
instead of
case '80-89':
{
cout << "Your Grade is B" << endl;
break;
}
Aucun commentaire:
Enregistrer un commentaire