/* John Waymouth * * Professional vote-tallying software written with extensibility in mind. */ #include #include #define NUMCANDIDATES 3 struct TallyItem { char *candidate; long votes; }; void doTally(char vote,char *candidate, long int &votes) { if (vote == candidate[0]) votes++; } int main () { char c; int i; int total=0; TallyItem tally[NUMCANDIDATES]={{"Kerry"},{"Bush"},{"Nader"}}; while((c=getchar())!=EOF) { if (isspace(c)) continue; total++; i=0; while(i