cpp A group of students decided to run in the Columbus Marathon. Their names and
ID: 3683458 • Letter: C
Question
cpp A group of students decided to run in the Columbus Marathon. Their names and times (in minutes) are below:
Name Time (minutes)
Elena
341
Thomas
273
Hamilton
278
Suzie
329
Phil
445
Matt
402
Alex
388
Emma
275
John
243
James
334
Jane
412
Emily
393
Daniel
299
Neda
343
Aaron
317
Kate
265
Find the fastest two runners.
In particular, write a program as follows. Print the list of runners and times as above. Then print the name of the fastest runner and his/her time (in hours and minutes). Also, find the second fastest runner. Print the name and his/her time (in hours and minutes).
The program must have a method that takes as input an array of integers and returns the index corresponding to the person with the lowest time. The Program must also have a second method to find the second-best runner. The second method can use the first method to determine the best runner, and then return the index corresponding to the person with the second lowest time.
Extra Credit (10 points): Print the list of runners and times nicely formatted in columns as displayed above.
Here is some program code to get started:
#include <iostream>
#include <string>
using namespace std;
int main (){
const int numRunners = 16;
string names[] ={"Elena", "Thomas", "Hamilton", "Suzie", "Phil",
"Matt", "Alex", "Emma", "John", "James", "Jane", "Emily", "Daniel",
"Neda","Aaron", "Kate"};
int times[] ={341, 273, 278, 329, 445, 402, 388, 275, 243, 334, 412,
393, 299,343, 317, 265};
. . .
for (int i = 0; i < numRunners; i++) {
cout << names[i] << ": " << times[i];
}}
Elena
341
Thomas
273
Hamilton
278
Suzie
329
Phil
445
Matt
402
Alex
388
Emma
275
John
243
James
334
Jane
412
Emily
393
Daniel
299
Neda
343
Aaron
317
Kate
265
Explanation / Answer
Hi for your reference i have written the code below, Try something like this,
#include <iostream>Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.