Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- struct Item
- {
- string name;
- double price;
- int quantity;
- };
- void addItem (Item &item);
- void listItems(
- int main ()
- {
- int menu; //menu selection input
- Item item; //structure variable for Item
- cout << "Please view the allowable options with your cart.\n";
- cout << "1. Add - Allows addition of item to cart.\n";
- cout << "2. List - Lists contents of current cart; including price and quantity.\n";
- cout << "3. Total - Displays current final total w/o sales tax.\n";
- cout << "4. Quit Program.\n"
- cout << "Please enter a menu choice 1 - 4: " << endl;
- cin << menu;
- while ((menu > 4) && (menu < 1))
- {
- cin.clear();
- cin.ignore(1000, '\n');
- cout << "ERROR"
- cout << "Please be sure to enter a number between 1 and 4"
- cin << menu;
- }
- switch (menu)
- {
- case 1:
- addItem(item);
- break;
- case 2:
- break;
- case 3:
- break;
- case 4:
- return(0);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement