#include "stdio.h"
#include "stdlib.h"
#include "time.h" //THis program inputs character data //counts grades int main() { int grade; int acount = 0, bcount = 0, ccount = 0, dcount = 0, fcount = 0; printf ("Enter the letter grades \n"); printf ("Enter the EOF character to end the input (Ctrl Z) \n"); while ( (grade = getchar() ) != EOF ) { switch (grade) { case 'A': case 'a': ++acount; break; case 'B': case 'b': ++bcount; break; case 'C': case 'c': ++ccount; break; case 'D': case 'd': ++dcount; break; case 'F': case 'f': ++fcount; break; default: printf ("Incorrect letter grade entered."); printf (" Enter a new grade \n"); break; } /* end switch grade */ } /* end while grade */ printf ("\nTotals for each letter grade are :\n"); printf ("A: %d\n", acount); printf ("B: %d\n", bcount); printf ("C: %d\n", ccount); printf ("D: %d\n", dcount); printf ("F: %d\n", fcount); return 0; }