// july15e2.cpp : Defines the entry point for the console application.
// Count Grades - demonstrates char type

#include "stdafx.h"

int main(int argc, char* argv[])
{ 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 was entered \n");
			 printf(" Please 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;
}