From 751274bdbe8885673a3c7b15f8f9c146ae86a473 Mon Sep 17 00:00:00 2001 From: Samuel Oberhofer Date: Mon, 23 May 2022 21:17:15 +0200 Subject: [PATCH] Add sort to Sortiment --- Uebung 1/Sortiment.cpp | 20 ++++++++++++++++++++ Uebung 1/Sortiment.h | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Uebung 1/Sortiment.cpp b/Uebung 1/Sortiment.cpp index c78282a..1f7ce57 100644 --- a/Uebung 1/Sortiment.cpp +++ b/Uebung 1/Sortiment.cpp @@ -1,4 +1,6 @@ #include "Sortiment.h" +#include "Algorithms.h" +#include void Sortiment::addWare(Ware *ware) { for (int i = 0; i < 10; i++) { @@ -6,4 +8,22 @@ void Sortiment::addWare(Ware *ware) { this->waren[i] = ware; } } +} + +void Sortiment::sort(int modus) { + switch (modus) { + case 1: + break; + case 2: + bubbleSort(this->waren); + break; + case 3: + break; + case 4: + break; + case 5: + break; + default: + std::cout << "Wrong Mode!" << std::endl; + } } \ No newline at end of file diff --git a/Uebung 1/Sortiment.h b/Uebung 1/Sortiment.h index ce3213c..4f6e622 100644 --- a/Uebung 1/Sortiment.h +++ b/Uebung 1/Sortiment.h @@ -9,8 +9,9 @@ private: public: void addWare(Ware *ware); Sortiment() { - for (int i = 0; i < 10;) { + for (int i = 0; i < 10; i++) { waren[i] = nullptr; } } + void sort(int modus); }; \ No newline at end of file