Add sort to Sortiment

This commit is contained in:
Samuel Oberhofer 2022-05-23 21:17:15 +02:00
parent 7b47854cb9
commit 751274bdbe
2 changed files with 22 additions and 1 deletions

View File

@ -1,4 +1,6 @@
#include "Sortiment.h" #include "Sortiment.h"
#include "Algorithms.h"
#include <iostream>
void Sortiment::addWare(Ware *ware) { void Sortiment::addWare(Ware *ware) {
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
@ -6,4 +8,22 @@ void Sortiment::addWare(Ware *ware) {
this->waren[i] = 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;
}
} }

View File

@ -9,8 +9,9 @@ private:
public: public:
void addWare(Ware *ware); void addWare(Ware *ware);
Sortiment() { Sortiment() {
for (int i = 0; i < 10;) { for (int i = 0; i < 10; i++) {
waren[i] = nullptr; waren[i] = nullptr;
} }
} }
void sort(int modus);
}; };