I am trying to take an input of different speeds from athletes and then display the fastest, the slowest, the speeds under 5:00, and the average. The times are inputted by mins seconds[enter]. The output should be in mins:seconds and should be displayed as: The fastest time is #2 at 4:03. My issue is that I can't figure out how to get the function to display the time correctly and to display the specific athlete number before it like it is supposed to be displayed.
You have a void function meaning it return no value so within your display function there should be a cout statement. Not sure if i understood the question correctly
I apologize I had augmented this earlier and had taken it out out. The main point was I am trying to get athletes number into a variable so I can display it. Like,
"The fastest speed belongs too " << fastest_Athlete << "and his speed is " << fastest << endl;
so you have 10 athletes in your array and you want to determine which one is the fastest and display the speed? You wouldnt be able to display a name only the location in the array of the fastest time. But to determine who is the fastest just declare a variable called fastestAthlete = totalseconds[0] ; then create a for loop to cycle through your array. Within your for loop should be an if statement which checks to see if the time is faster than the time store in fastestAthlete If thats true then fastestAthlete = totalSeconds[i];