Algorithmen_Datenstrukturen/Uebung 1/Sortiment.cpp

33 lines
583 B
C++

#include "Sortiment.h"
#include "Algorithms.h"
#include <iostream>
void Sortiment::addWare(Ware *ware) {
for (int i = 0; i < 10; i++) {
if (this->waren[i] == nullptr) {
this->waren[i] = ware;
break;
}
}
}
void Sortiment::sort(int modus) {
switch (modus) {
case 1:
quicksort(this->waren, 0, 9);
break;
case 2:
bubbleSort(this->waren);
break;
case 3:
break;
case 4:
insertionSort(this->waren, 1);
break;
case 5:
insertionSort(this->waren, 0);
break;
default:
std::cout << "Wrong Mode!" << std::endl;
}
}