Sort by weight
This commit is contained in:
parent
18a1062cfc
commit
0cbb799da4
|
|
@ -1,10 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "Sortiment.h"
|
#include "Sortiment.h"
|
||||||
|
#include "Ware.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
void bubbleSort(Ware *waren[10]) {
|
void bubbleSort(Ware *waren[10]) {
|
||||||
for (int i = 0; i < 10; i++) {
|
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]);
|
std::swap(waren[i], waren[i + 1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue