source.cpp

#include "pallet.h" #include <iostream> #include <string> #include <vector> using namespace std; int main() { int additem, position, menu, PalletID; string item; //Pallet p(0, 2); Pallet p; cout << "What is the weight of the pallet: " << endl; cin >> p.PalletWeight; bool CarryOn = true; while (CarryOn) { cout << "Press 1 to Add a new item" << endl; cout << "Press 2 to list all of the items" << endl; cout << "Press 3 to check a position" << endl; cout << "Press 4 to remove an item" << endl; cout << "Press 5 to view the current pallet weight" << endl; cout << "Press 6 to view the max pallet weight" << endl; cout << "Press 0 to exit" << endl; cin >> menu; if (menu == 1) { cout << "Enter the item you would like to add to the pallet: " << endl; cin >> item; p.AddItem(item); } if (menu == 2) { p.ListAllItems(); } if (menu == 3) { cout << "What position in the pallet would you like to check" << endl; cin >> position; p.GetItemAtPosition(position); } if (menu == 4) { cout << "The top item has been removed!" << endl; p.RemoveTopItem(); } if (menu == 5) { cout << "The current weight of the pallet is: " << p.GetCurrentWeight() << endl; } if (menu == 6) { cout << "The max weight of the pallet is: " << p.GetMaxWeight() << endl; } if (menu == 0) { cout << "Thanks for using this program" << endl; break; } } return 0; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.