Votes Calculator Help!

Hi Guys, got a class project that ive been spending about a week on and off trying to complete it. I finally got the whole thing compeleted. Ive done whats been asked of me, but would like to take it one step further, and was hoping someone here could point me in the right direction.

Basically the program is a votes calculator. However, I would like functionality so that the program will output if the vote has been a draw, and who the candidates names are.

Any help would be greatly appreciated!

1
2
3
4
5
6
7
8
9
10
11
12
#define noRegions 4
#define noPeople 4
string regionName[noRegions];

struct voteBluePrint
{
	char candName[10];
	float candVotes;
	float candPerc;
};

voteBluePrint votes[noRegions][noPeople];


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void showTheWinners()
{
	for (int i= 0; i<noRegions;i++)				//Loop through the regions
	{
		float mostVotes = 0;
		int mostVotesPerson = 0;
		for (int j = 0;j<noPeople;j++)
			if (votes[i][j].candVotes > mostVotes)
			{
				mostVotes = votes[i][j].candVotes;
				mostVotesPerson = j;
			}
		cout << regionName[i] << " winner is " << votes[i][mostVotesPerson].candName << " with " << mostVotes << " votes" << endl; 
	}
}
Topic archived. No new replies allowed.