Advertisement
Lawnknome

shopCart.cpp

Nov 20th, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5.  
  6. struct Item
  7. {
  8.     string name;
  9.     double price;
  10.     int quantity;
  11. };
  12.  
  13.  void addItem (Item &item);
  14.  void listItems(
  15.  
  16. int main ()
  17. {
  18.     int menu;               //menu selection input
  19.     Item item;              //structure variable for Item
  20.  
  21.     cout << "Please view the allowable options with your cart.\n";
  22.     cout << "1. Add - Allows addition of item to cart.\n";
  23.     cout << "2. List - Lists contents of current cart; including price and quantity.\n";
  24.     cout << "3. Total - Displays current final total w/o sales tax.\n";
  25.     cout << "4. Quit Program.\n"
  26.     cout << "Please enter a menu choice 1 - 4: " << endl;
  27.     cin << menu;
  28.  
  29.     while ((menu > 4) && (menu < 1))
  30.     {
  31.         cin.clear();
  32.         cin.ignore(1000, '\n');
  33.         cout << "ERROR"
  34.         cout << "Please be sure to enter a number between 1 and 4"
  35.         cin << menu;
  36.     }
  37.  
  38.     switch (menu)
  39.     {
  40.         case 1:
  41.             addItem(item);
  42.             break;
  43.  
  44.         case 2:
  45.  
  46.         break;
  47.  
  48.         case 3:
  49.  
  50.         break;
  51.  
  52.         case 4:
  53.             return(0);
  54.     }
  55.  
  56.     return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement