Computing grade sign

Writing a program to compute the grade and give a grade sign. I got down the compute grade part done, but I'm having problem calculating a sign using switch.

Any ideas on how to do that?

Thanks,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 int computeLetterGrade()
{
   int grade;
   cout << "Enter number grade: ";
   cin >> grade;
   char letterGrade;
   switch (grade /10)
   {
      case 10:
      case 9:
         letterGrade = 'A';
         break;
      case 8:
         letterGrade = 'B';
         break;
      case 7:
         letterGrade = 'C';
         break;
      case 6:
         letterGrade = 'D';
         break;
      default:
         letterGrade = 'F';
   }
   return letterGrade;
}
Last edited on
why not trying to use series of If statements as follows:

if (point>=70)
letterGrade='A';

Elseif (point<=69 && point>64)
letterGrade='B';

Elseif (point<=64 && point>54)
letterGrade='C';

Elseif (point<= 54 && point>44)
letterGrade='C';
.
.
.
else
letterGrade ='F';
Topic archived. No new replies allowed.