raxbg

main.cpp

May 17th, 2011
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1. #include <iostream>
  2. #include "Items.h"
  3.  
  4. using namespace std;
  5.  
  6. void printMenu();
  7. int getWhatTheyWant();
  8.  
  9. int main()
  10. {
  11.     int whatTheyWant;
  12.     Items itemsList;
  13.  
  14.     do {
  15.         printMenu();
  16.         whatTheyWant = getWhatTheyWant();
  17.         switch (whatTheyWant){
  18.             case 1:
  19.                 itemsList.printPlainItems();
  20.                 break;
  21.             case 2:
  22.                 itemsList.printPositiveItems();
  23.                 break;
  24.             case 3:
  25.                 itemsList.printNegativeItems();
  26.                 break;
  27.         }
  28.     }while(whatTheyWant<4 && whatTheyWant>0);
  29.  
  30.     return 0;
  31. }
  32.  
  33. int getWhatTheyWant(){
  34.     int choice;
  35.     cin >> choice;
  36.     return choice;
  37. }
  38.  
  39. void printMenu(){
  40.     cout << "1 - just plain items" << endl;
  41.     cout << "2 - helpful items" << endl;
  42.     cout << "3 - harmful items" << endl;
  43.     cout << "anything else will quit program" << endl;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment