From 7b47854cb93fe79d2848c7319496ffc3b85d9217 Mon Sep 17 00:00:00 2001 From: Samuel Oberhofer Date: Mon, 23 May 2022 21:16:37 +0200 Subject: [PATCH] Add BubbleSort --- Uebung 1/Algorithms.h | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Uebung 1/Algorithms.h diff --git a/Uebung 1/Algorithms.h b/Uebung 1/Algorithms.h new file mode 100644 index 0000000..0f06185 --- /dev/null +++ b/Uebung 1/Algorithms.h @@ -0,0 +1,11 @@ +#pragma once +#include "Sortiment.h" +#include + +void bubbleSort(Ware *waren[10]) { + for (int i = 0; i < 10; i++) { + if (waren[i] > waren[i + 1]) { + std::swap(waren[i], waren[i + 1]); + } + } +} \ No newline at end of file