Question: Trying to find a way to exit the program by having user enter a value 0; 15 9.Hinclude 19 11 int main(void) 12 { unsigned

Trying to find a way to exit the program by having user enter a value
Trying to find a way to exit the program by having user
enter a value 0; 15 9.Hinclude 19 11 int main(void) 12 {
unsigned int aCount = 14 unsigned int bCount = unsigned int count
B; 16 unsigned int dCount = @; 17 unsigned int fCount 18

0; 15 9.Hinclude 19 11 int main(void) 12 { unsigned int aCount = 14 unsigned int bCount = unsigned int count B; 16 unsigned int dCount = @; 17 unsigned int fCount 18 19 puts("Enter the letter grades."); 20 put ("Enter the z character to end input."); 21 22 int grade; // one grade 23 24 25 // Loop until user types end-of-file key sequence 26 while((grade = getchar()) != 0) { 27 28 switch(grade) { // switch nested in while 29 30 case 'A': // grade was uppercase A case 'a': // or Lowercase a " 32 ++aCount; 33 break; // necessary to exit switch 34 31 35 36 37 38 39 case 'B': // grede was uppercase A case 'b': // or lowercase a ++bCount; break; // necessary to exit switch LASCIA Enter the character to end input. W Loop until user types end-of-file key sequence wale ((grade ()) != 0) { swatch(grade) (switch nested in white case 'A': // grade was uppercase A case 'a': // or lowercase a +aCount; break; // necessary to exit switch 34 35 36 37 case '8': // grade was uppercase A case 'b': // or Lowercase a ++bCount; break; // necessary to exit switch 38 case 'C': // grade was uppercase A case 'c': // or Lowercase a ++cCount; break; // necessary to exit switch 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 SA 55 case 'D': // grade was uppercase A case 'd': // or lowercase a ++dCount; break; // necessary to exit switch case 'F': // grade was uppercase A case 'f': // or Lowercase a ++fCount; break; // necessary to exit switch case ' ': // ignore newlines, Enter the z character to end input. Count; break; necessary to exit switch case 'D'://grade was uppercase A case d': / or lowercase a HidCount; break; 11 necessary to exit stitch case 'F': 11 grade was uppercase A case 'f': // or Lowercase a fCount; break; // necessary to exit switch 55 56 57 58 59 60 61 case ' '; // ignore newlines, case '\t': // tabs case: // and spaces in input break; 62 63 default: // catch all other characters printf("%s", "Incorrect letter grade entered."); puts(" Enter a new grade."); break; // optional; will exit switch anyway 64 8gsmagggggg58 65 66 67 68 69 70 71 72 73 74 } // end while Enter the character to end input. break; necessary to exit switch Game A: ignore newlines, case 1: tabs :ll and spaces in input break; default: // catch all other characters ("%s", "Incorrect letter grade entered."); put("Enter a new grade."); break; // optional; will exit switch anyway 6 7 58 69 w%wa 71 72 73 74 } // end while 75 76 // output summary of results 77 puts(" Totals for each letter grade are: "); 78 printf("A: %u ", aCount); 79 printf("B: %u ", bCount); 80 printf("C: %u ", cCount); 81 printf("D: %u ", dCount); 82 printf("F: %u ", fCount); 83 84) 85 Enter the z character to end input

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!