Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.31 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.  
  7. int froyoStamps = 0;
  8.  
  9. while (1)
  10. {
  11.  
  12. char userSelection = ' ';
  13.  
  14.  
  15. //print menu
  16. cout << "Press P to purchase Froyo" << endl;
  17. cout << "Press S to stop" << endl;
  18. cin >> userSelection;
  19.  
  20.     if (input == 'P' || input == 'p')
  21.     {
  22.         int froyoPurchase;
  23.        
  24.         //freebies
  25.         if //(eligible for freebies)
  26.         {
  27.             char freeAnswer = ' ';
  28.            
  29.             cout << "You are eligible for a free yogurt." << endl;
  30.             cout << "Would you like one? Yes/No: "
  31.             cin >> freeAnswer;
  32.            
  33.             if (freeAnswer == 'y' || freeAnswer == 'Y')
  34.             {
  35.                 stamps -= 10;
  36.             }
  37.  
  38.             if (freeAnswer == 'n' || freeAnswer == 'N')
  39.             {
  40.                 //go to transaction
  41.             }
  42.            
  43.             //error check
  44.             else ()
  45.             {
  46.                 //error message
  47.                 //next loop pass
  48.             }
  49.         }
  50.        
  51.         //transaction
  52.         cout << "How many Fro-yos would you like to buy: ";
  53.         cin >> froyoPurchase;
  54.        
  55.         if (//froyoPurchase is a valid number)
  56.         {
  57.             continue to free item check
  58.         }
  59.            
  60.         //transaction error check
  61.         if invalid number
  62.         {
  63.             "you fucked up"
  64.             exit
  65.         }
  66.        
  67.        
  68.        
  69.         if if they aren't eligible for freebies
  70.         {
  71.         go back to menu
  72.         }
  73.     }
  74.  
  75.     if (input == 's' || input == 'S')
  76.     {
  77.         cout << "You pressed 'S'. Goodbye." << endl;
  78.         //exit
  79.     }
  80.  
  81.     else
  82.     {
  83.         cout << "ERROR." << endl;
  84.         //exit
  85.     }
  86. }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement