Hi people i am kind lost at where to start for this lab assignment i have gotten for my mid term break:

Problem
It's London!
International Olympic Committee President Jacques Rogge has announced that London will host the 2012
Olympic Games and Paralympic Games.
6 July, 2005, Singapore
London succeeded in her bid to host the game after 4 rounds of voting:
First round:
London 22
Paris 21
New York 19
Moscow 15 (eliminated)
Second round:
London 27
Paris 25
New York 16 (eliminated)
Third round:
London 39
Paris 33
Fourth round:
London 54
Paris 50 (eliminated)
If there are more than 10 cities competing to host the Olympic, there will be more rounds of voting, and
vote casting could become a marathon meeting. To avoid many rounds of vote casting, perhaps the
committee should use Australian ballots.
Australian ballots require that the voters rank the candidates in order of their choice. Initially only the first
choices of all voters are counted. If one candidate receives more than 50% of the vote, that candidate is
elected. If no candidate receives more than 50%, all candidates tied for the lowest number of votes are eliminated. When candidates eliminated received 0 vote, then the result of counting will not be changed. Only when the eliminated candidates have non-zero vote counts, then the ballots voted for these eliminated candidates are recounted in favour of their next highest
ranked candidate who has not been eliminated. This process continues until one candidate receives more than 50% of the vote or until all candidates are tied.
For example, suppose there are 4 cities involved, namely A, B, C and D. According to the first choice of the
100 votes received, 40 are for A and D, with B and C are getting 10 votes each. Since none of them receive a
majority, B and C are tied with the lowest vote count (10) and they are eliminated. Those who voted for B
and C will have their votes recount, using their second choice, or third choice when their second choice is also a city that has been eliminated (B or C). After the recount, A has 55 votes and D has 45 votes. So A is the winner.
You are required to write a program to solve this problem. Since this exercise is on STL queue handling, the ranking of candidates found in a ballot should be organized as a queue. When a candidate is eliminated, the votes for this candidate are to be removed from the queues eventually.
Input
The first line of input is an integer n <= 20 indicating the number of candidates. The next n lines consist of
the names of the candidates, one name per line. Names may be up to 80 characters in length and may
contain any printable characters. After these n lines, up to 1000 lines follow with one line for one ballot.
Each line contains exactly n numbers in the range from 1 to n in some order. The first number is the
candidate of first choice; the second number is the candidate of second choice, and so on.
Sample Input 1
3
London
Paris
1 2 3
2 1 3
2 3 1
1 2 3
3 1 2
Sample Input 2
3
London
Paris
1 2 3
2 1 3
2 3 1
1 2 3
3 1 2
3 1 2
Output
The Output consists of one line containing either the name of the winner or “no winner” when all
candidates tied.
Sample Output 1 (corresponding to sample input 1)
London
Sample Output 2 (corresponding to sample input 2)
no winner

I was thinking of placing each ranking of each person into one element of vector<int>. Then will check the first int ranking of the person, in order to find out the person's first ranking. Then i will increment the respective country's votes by 1. Hmm but how to go about incrementing the country's votes? Use struct?

If you want someone to help you, it would be really better if you err... made your problem description a bit brief giving us what you have so far gathered about the problem and what have u decided till now.

Try to make a skeleton or the framework for your project writing down only the basic things and then post the problem in which you are stuck on. Maybe then we would be able to help you a bit.

Hope it helped, bye.

> Since this exercise is on STL queue handling, the ranking of candidates found in a ballot should be organized as a queue
The assignment tells you what to use.

So a queue containing pairs of "who" and "how many" would seem to be the thing.

I was wondering if you could enlighten me on the pairs of "who" and "how many".

Because i was told there could be at most 20 countries in this balloting thingy. I just dunno how to reconcile the voting numbers as well as using queues to eliminate the candidates, according to the question.

Thanks.

Regards,
Nick.

> Since this exercise is on STL queue handling, the ranking of candidates found in a ballot should be organized as a queue
The assignment tells you what to use.

So a queue containing pairs of "who" and "how many" would seem to be the thing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.