0

A newbie in c++ need help with this question

Write a program that uses switch multiple selection statement to count the number of different grades.test it with the following input=A output=1

4th Oct 2020, 8:42 PM
Valentine Gatwiri
Valentine Gatwiri - avatar
3 Answers
+ 1
Valentine Gatwiri you're code logic is okay. Now all you have to do is add declarations for the Count variables e.g. int aCount,bCount ... and also cases for all the alphabetical letters(since you only want to use switch)e.g
5th Oct 2020, 9:00 AM
Anthony Maina
Anthony Maina - avatar
0
void countGrades(char letter) { switch (letter ) { case 'A': aCount +=1; break; case 'B': bCount +=1; break; case 'C': cCount += 1; break; default: fCount += 1; } }
5th Oct 2020, 6:30 AM
Valentine Gatwiri
Valentine Gatwiri - avatar
0
Ok thanks let me try that
5th Oct 2020, 9:04 AM
Valentine Gatwiri
Valentine Gatwiri - avatar