aboutsummaryrefslogtreecommitdiff
path: root/week01
diff options
context:
space:
mode:
authorSyndamia <kamen@syndamia.com>2024-03-17 18:22:15 +0200
committerSyndamia <kamen@syndamia.com>2024-03-17 18:22:15 +0200
commit9f6607ad802a11bb04937d0cc5a254d63f127102 (patch)
tree9d7e89998132ee013417edebce20690c89fa98a1 /week01
parent22618e5dd9de67b6a3599c09c521ba610de05ffb (diff)
downloadoop-2023-solutions-9f6607ad802a11bb04937d0cc5a254d63f127102.tar
oop-2023-solutions-9f6607ad802a11bb04937d0cc5a254d63f127102.tar.gz
oop-2023-solutions-9f6607ad802a11bb04937d0cc5a254d63f127102.zip
[w1/ex4] Reorganized sorting
Diffstat (limited to 'week01')
-rw-r--r--week01/Exercise4.cpp10
1 files changed, 5 insertions, 5 deletions
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];