Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int firstThreePlaces(struct athletesInformation arrayOfAthletes[], int sizeOfArray)
- {
- int FirstPlace = 0 ;
- int SecondPlace = 0;
- int ThirdPlace = 0 ;
- for (int i = 0; i < sizeOfArray; i++)
- {
- if ((arrayOfAthletes[i].athelteRaceTime < arrayOfAthletes[FirstPlace].athelteRaceTime) && (arrayOfAthletes[i].athelteRaceTime != NULL))
- {
- SecondPlace = FirstPlace;
- FirstPlace = i;
- }
- }
- for (int i = 0; i < sizeOfArray; i++)
- {
- if (arrayOfAthletes[i].athelteRaceTime < arrayOfAthletes[SecondPlace].athelteRaceTime && arrayOfAthletes[i].athelteRaceTime > arrayOfAthletes[FirstPlace].athelteRaceTime && arrayOfAthletes[i].athelteRaceTime != NULL)
- {
- SecondPlace = i;
- }
- }
- for (int i = 0; i < sizeOfArray; i++)
- {
- if (arrayOfAthletes[i].athelteRaceTime < arrayOfAthletes[ThirdPlace].athelteRaceTime && arrayOfAthletes[i].athelteRaceTime > arrayOfAthletes[SecondPlace].athelteRaceTime && arrayOfAthletes[i].athelteRaceTime != NULL)
- {
- ThirdPlace = i;
- }
- }
- cout << arrayOfAthletes[FirstPlace].athleteFirstName << " " << arrayOfAthletes[FirstPlace].athelteLastName << " won the first place with the time of " << arrayOfAthletes[FirstPlace].athelteRaceTime << endl
- << arrayOfAthletes[SecondPlace].athleteFirstName << " " << arrayOfAthletes[SecondPlace].athelteLastName << " won the second place with the time of "<< arrayOfAthletes[SecondPlace].athelteRaceTime << endl
- << arrayOfAthletes[ThirdPlace].athleteFirstName << " " << arrayOfAthletes[ThirdPlace].athelteLastName << " won the third place with the time of " << arrayOfAthletes[ThirdPlace].athelteRaceTime << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement