Professional Documents
Culture Documents
Universidad Carlos Iii de Madrid Programming. Final Exam. June 2018. Surname(s) : - Name
Universidad Carlos Iii de Madrid Programming. Final Exam. June 2018. Surname(s) : - Name
Problem 1
In this problem, you are going to design a C program to manage the information about the results of the
World Motorcycle Championship in the Moto GP category
Up to 23 pilots participate in this Championship, and the season (temporada) consists of 18 races in 18
different circuits
Prior to the race, a qualifying practice session (entrenamientos oficiales) takes place. The qualifying times in
this session determine the exit order of the pilots for the race itself. The best pilot in the qualifying session
earns the pole position (first exit position in the race).
After each race, the pilots in the 18 first positions earn points depending on their placement: the 1st pilot is
awarded 18 points, the 2nd 17, and so on. Pilots in position 19 and lower get 0 points.
The points earned in each race add up to determine the ranking (order of pilots). At the end of the season,
the first pilot in the ranking is awarded the Championship.
4. [3 points] Write a function named displayRanking that displays the result of each of the
pilots and the following information
• The World Champion (pilot who won the World Championship) and his score
• The pilot with the most victories (pilot who won the most races), and number of races won
• The pilot with the most pole positions and number pole positions
The function must have the following header
void displayRanking (struct typePilot pilots [],int numPilots);
This is an example of the expected display:
NUMBER NAME SCORE RACES WON POLES
99 Jorge Lorenzo 34 0 1
94 Jonas Folger 32 0 0
93 Marc Marquez 36 2 0
The world champion is:
Marc Marquez. Number: 93. Team: Honda. Country: Spain. Score: 36
The pilot who won the most races is:
Marc Marquez. Number: 93. Team: Honda. Country: Spain. Victories: 2
The pilot with the most pole positions:
Jorge Lorenzo. Number: 99. Team: Ducati. Country: Spain. Poles: 1
To solve this section you can assume you have a function which displays the name, number, team
and country of a pilot, with the following header
void displayPilot (struct typePilot pilot);