All pastes #225881 Raw Edit

Untitled

public c v1 · immutable
#225881 ·published 2006-10-28 05:51 UTC
rendered paste body
/*  * Name: Philip Lanxon			 * Collaborator(s): Abbie Mccourt	 * Instructor:  * Date: 10/27/06 * Assignment: pgm4 * Description: Take in voter data from a txt document, then output results. */#include <stdio.h>#include <stdlib.h>int main(void){	int voterid, vote, ted = 0, ron = 0, other = 0;	FILE *fp; 		fp = fopen("votingdata.txt", "r");	while (fscanf(fp, "%d %d", &voterid, &vote) == 2)     {		fscanf(fp, "%d %d", &voterid, &vote);		switch(vote){			case 1:				printf("%d Ted Kulongoski \n", voterid);				++ted;				break;			case 2:				printf("%d Ron Saxton \n", voterid);				++ron;				break;			default:                ++other;                break;		}		}	printf("%d %d %d", ted, ron, other);  getchar();  system("PAUSE");	  return 0;}