#include #include enum { bush=0, kerry=1, nader=2, other=3, }; int Tally[4]={0}; int Tallymap[256]={54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54}; int main () { int Input; int i; for (i = 0; i < sizeof(Tally); i++) { /* set default tally to "other" */ Tallymap[i] = other; } Tallymap['B'] = bush; Tallymap['N'] = nader; Tallymap['K'] = kerry; /* count 'em up, Secretary Harris */ while ((Input=getchar())!=EOF) { unsigned char Vote = Input; if (!isspace(Vote)) Tally[Tallymap[Vote]]++; } /* Output results -- note that I did include the colon missing from the framework */ printf("Kerry: %d\n",Tally[kerry]); printf("Bush: %d\n",Tally[bush]); printf("Nader: %d\n",Tally[nader]); printf("Other: %d\n",Tally[other]); return 0; }