From 0cbb799da4098c9f5b3fec530a156e16f92389fa Mon Sep 17 00:00:00 2001 From: Samuel Oberhofer Date: Mon, 23 May 2022 21:19:36 +0200 Subject: [PATCH] Sort by weight --- Uebung 1/Algorithms.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Uebung 1/Algorithms.h b/Uebung 1/Algorithms.h index 0f06185..d7b610e 100644 --- a/Uebung 1/Algorithms.h +++ b/Uebung 1/Algorithms.h @@ -1,10 +1,11 @@ #pragma once #include "Sortiment.h" +#include "Ware.h" #include void bubbleSort(Ware *waren[10]) { for (int i = 0; i < 10; i++) { - if (waren[i] > waren[i + 1]) { + if (waren[i]->getGewicht() > waren[i + 1]->getGewicht()) { std::swap(waren[i], waren[i + 1]); } }