From 9f6607ad802a11bb04937d0cc5a254d63f127102 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 17 Mar 2024 18:22:15 +0200 Subject: [w1/ex4] Reorganized sorting --- week01/Exercise4.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'week01/Exercise4.cpp') diff --git a/week01/Exercise4.cpp b/week01/Exercise4.cpp index 93c8eb9..29a231e 100644 --- a/week01/Exercise4.cpp +++ b/week01/Exercise4.cpp @@ -12,6 +12,10 @@ struct Flight { float flightPrice; }; +/* + * Подточка а) + */ + void sortByTakeoff(Flight* flights, int N) { for (int i = 0; i < N-1; i++) { for (int j = 0; j < N-1 - i; j++) { @@ -24,11 +28,8 @@ void sortByTakeoff(Flight* flights, int N) { } } -/* - * Подточка а) - */ - void A(Flight* flights, int N) { + sortByTakeoff(flights, N); for (int i = 0; i < N; i++) { std::cout << flights[i].takeoffCity << " " << flights[i].landingCity << " " << flights[i].flightPrice << std::endl; } @@ -257,7 +258,6 @@ int main() { >> flights[i].landingTime >> flights[i].flightPrice; } - sortByTakeoff(flights, N); char cityToTakeoff[1024]; char cityToLand[1024]; -- cgit v1.2.3