Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Warehouse::bestandsListeAusgeben(){
- int lagerplatz;
- int matStock;
- sortimentNachBestandSortieren();
- cout << "Bestandsliste:" << endl;
- cout.width(10);
- cout << left << "Mat. Nr.";
- cout.width(14);
- cout << left << "Materialtext";
- cout.width(10);
- cout << left << "Bestand";
- cout.width(10);
- cout << left << "Lagerplatz" << endl;
- for (int i = 0; i < this->sortiment.size(); i++) {
- cout.width(10);
- cout << left << this->sortiment.at(i)->getmatNumber();
- cout.width(14);
- cout << left << this->sortiment.at(i)->getmatText();
- cout.width(10);
- cout << left << this->sortiment.at(i)->getStock();
- cout.width(10);
- matStock = this->sortiment.at(i)->getStock();
- for (int j = 0; j < matStock ; j++)
- {
- lagerplatz = this->sortiment.at(i)->getLocationAtPosition(j);
- lagerPlatzErmitteln(lagerplatz);
- if (j > 0)
- {
- cout.width(34);
- cout << left << "-";
- }
- }
- cout << endl;
- }
- }
- void Warehouse::sortimentNachBestandSortieren()
- {
- for (int i = 1; i < this->sortiment.size(); i++) // Durchläufe
- for (int j = this->sortiment.size() - 1; j >= i; j--) {// Schritte in einem Durchlauf
- if (this->sortiment.at(j - 1)->getStock() < this->sortiment.at(j)->getStock()) { // vertauschen zweier Elemente falls noetig
- Material* tmp = this->sortiment.at(j - 1);
- this->sortiment.at(j - 1) = this->sortiment.at(j);
- this->sortiment.at(j) = tmp;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement