// vote.c // by thrapt #include #include int main () { int Input; unsigned long total=0; unsigned long Tally[256]={0}; unsigned long *fp; // ascii is the law int K = 75; int B = 64; int N = 78; // and pointers are more elegant. Leet fp = Tally; while ((Input=getchar())!=EOF) { unsigned char Vote=Input; toupper(Vote); if (!isspace(Vote)){ *(fp+((int)Input))+=1; total+=1; } } printf("Kerry %d\n", *(fp + K)); printf("Bush %d\n", *(fp + B)); printf("Nader %d\n", *(fp + N)); printf("Other %d\n",total-*(fp+75)-*(fp+66))-*(fp+77); // Did or didn't I have constants? Well, don't have time to waste now... // just get out and done! return 0; }