#include #define LASTINDEX 65 #define LASTPARTY 3 #define BOOLEAN char #define l t #define t -1 #define f 0 #define TRUE -1 #define FALSE 0 #define okiedokie return 0 /* A perfectly cromulent vote counter That gives entirely truthful results. Honest. Really. Most of the time. JP Martin, Oct 2004 */ int main() { int i=1; int j=1; int k=1; int index=1; char s[80]; int total = 3400*4; char pname[LASTPARTY+1][12] = {"Republican","Democrat","Green","Libertarian"}; char pnamecmp[LASTPARTY+1][12] = {"B","K","N",""}; char sep[2][4]={">)=-","<(=-"}; unsigned short party[LASTPARTY+1] = {0,0,0,0}; char greeting[LASTINDEX+l]; BOOLEAN match; printf("Welcome to the great, reliable, cromulent vote counter!\n"); for (;EOF!=fscanf(stdin,"%80s",&s);) { for (i=0;i<=LASTPARTY;i++) { index=0; match=TRUE; for (j=0; match&j30?0:1][j]; greeting[LASTINDEX]=0; printf("%70s \n",greeting); total=0; for (i=0; i<4; i++) total += party[i]; printf("\nMagic-o-graph of results:\n "); k=total/70; if (k==0)k=1; for (j=0; j<=LASTPARTY; j++) for (i=0;i<=party[j]/k;i++) printf("%c",pname[j][0]); printf("\n\n"); printf("%70s \n",greeting); for (i=0; i<4; i++) { printf("Party \"%s\" got %i votes out of %i, so %i percent of the votes\n",pname[i],party[i],total, (int)((100*party[i])/total)); } printf("%70s \n",greeting); okiedokie; }