Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 3. Olympics Medal Table (30 points) In Olympics, rank in medal table is decided using some specific rules. If a country has more gold
Problem 3. Olympics Medal Table (30 points) In Olympics, rank in medal table is decided using some specific rules. If a country has more gold medals than other, then its rank is higher; even if others have higher silver or bronze medals. If number of gold medals are equal for them, then silver medals come into account, irrespective of bronze medals. If both gold and silver medals are in same quantity, number of bronze medals are used for ranking. If all the medals are in equal number, then these countries are place in alphabetical order in the medal table. Suppose, you are asked to create a system that prints the medal table of Olympic with 2 countries. Your input would be those 2 countries name, their gold, silver and bronze medal quantities. Write a program that prints out the medal table of the Olympics in ascending order of rank; following the mentioned rules. Define a structure type which holds the name, medal quantities and rank of the country. You can use 2 structure type variables or an array of structure with 2 elements. Take the input into structure using proper techniques. Use conditional statements for deciding the rank. You might want to swap variables or print the rank after each conditions. Check this link for input-output: https://www.programiz.com/c-programming/examples/structure-store-information Sample Input and Output: (Your code should print the red texts on the screen. Black texts are sample user inputs)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started