All pastes #225871 Raw Edit

Stuff

public c v1 · immutable
#225871 ·published 2006-10-28 05:45 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, ron, other;	FILE *fp; 		fp = fopen("votingdata.txt", "r");	while (++vote)	{		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;}