/* File : countgrades.c *
* By : *
* login: *
* team : *
* Date : */
/* A program to count the number of grades occuring in the input */
#include <stdio.h>
int main()
{
int a;
int b;
int c;
int d;
int f;
int others;
a = b = c = d = f = 0;
others = 0;
while ((c = getchar()) != EOF)
{
switch(c)
{
case 'a': a++;
case 'b': b++;
case 'c': c++;
case 'd': d++;
case 'f': f++;
default: others++;
}
}
printf("Grade counts:\n");
printf(" A's: %d\n", a);
printf(" B's: %d\n", b);
printf(" C's: %d\n", c);
printf(" D's: %d\n", d);
printf(" F's: %d\n", f);
printf(" Other grades: %d\n", others);
}