All pastes #225916 Raw Edit

Someone

public c v1 · immutable
#225916 ·published 2006-10-28 06:23 UTC
rendered paste body
/*  * Name: Philip Lanxon			 * Collaborator(s): Abbie Mccourt, Micah	 * 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, scanResults, totalvotes;	FILE *fp; 		fp = fopen("votingdata.txt", "r");	while (EOF != (scanResults = fscanf(fp, "%d %d", &voterid, &vote))) 	{    		if(scanResults < 2)		{			printf("An error occured reading the file.");			break;		}		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;		}	}	totalvotes = (ted+ron+other);	printf("________________________________________\n");	printf("Ted = %d\nRon = %d\nError = %d\nTotal = %d", ted, ron, other, totalvotes);	getchar();		return 0;}