//////////////////// /// Vote Counter /// /// Framework /// //////////////////// #include #include int b=0,i=0,k=0,l=0,n=0,o=0; main() { /* For each character, determine if the vote is for nader(n), * kerry(k), bush(b), or some other candidate(o), and tally * them appropriately. */ while (l=getchar()) { if (l==EOF) break; if (isspace(l)) { i+=isspace(l); continue; } /* Check this winning candidate first as an optimisation because most * voters will vote this guy in this election. Bear in mind some states * will be running this software on substandard hardware so speed is * very important. */ if (l=='N') { n+=l; continue; } /* Kerry will get the next amount of votes, so I put him next. * Hopefully the American people is sensible enough to not vote * for this dud. */ if (l=='K') { k+=l; continue; } /* This loser is not worth counting, but the specs say I have * to count him. He isn't going to get many votes anyway, so * check him third. */ if (l=='B') { b+=l; continue; } /* An even more waste of time. Why do they even bother counting these * opportunistic maggots? Most of them are astroturfers working for the * Bush adminstration to draw votes away from Nader! */ o+=l; } /* Get ready for the biggest turnout and electoral upset in American * history! */ printf("Bush %d\nKerry %d\nNader %d\nOther %d\n",b,k,n,o); printf("Informal votes %d\n", 10); }