Advertisement
Guest User

Untitled

a guest
May 1st, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.93 KB | None | 0 0
  1. /*
  2.  Valentin Tsoy
  3.  CS1, Section 121
  4.  Assignmen 5, Problem 1
  5.  This program will model the Littleton City Lotto
  6.  (not a real Lotto game). The program is going to allow to user to first select their lotto
  7.  numbers. The program will then randomly generate the winning lotto numbers for the
  8.  week and then check the winning numbers against the random ticket the user played in
  9.  the Lotto to see how many numbers the user guessed correctly.
  10.  
  11.  -------------------------------Psuedocode-------------------------------
  12.  1. Data Given:
  13.  -
  14.  2. Data Needed:
  15.  -
  16.  3. Calculations:
  17.  -
  18.  4. Print results
  19.  -
  20.  ----------------------------End of Psuedocode---------------------------
  21.  */
  22.  
  23. #include <iostream>
  24. #include <iomanip>
  25. using namespace std;
  26.  
  27. // Prototype Functions
  28. void getLottoPicks(int * pUserTicket);
  29.  
  30. int main ()
  31. {
  32.     // Variable Declaration
  33.     int choice;
  34.     char user_name;
  35.    
  36.     const int SIZE = 7; // Constant for for the number of inputs
  37.     int UserTicket [SIZE]; // Declare Array
  38.    
  39.         cout << "LITTLETON CITY LOTTO MODEL:" << endl;
  40.         cout << "---------------------------" << endl;
  41.         cout << "1) Play lotto" << endl;
  42.         cout << "Q) Quit" << endl;
  43.         cout << "Please make a seletion: " << endl;
  44.         cin >> choice;
  45.  
  46.     if(choice == 1)
  47.     {
  48.         cout << "Please enter your name: " << endl;
  49.         cin >> user_name;
  50.     }
  51.    
  52.     // Calling Functions
  53.     getLottoPicks(UserTicket);
  54.    
  55.     return 0;
  56. } // End of Main Function
  57.  
  58. void getLottoPicks(int * pUserTicket)
  59. {
  60.     for (int i = 0; i < 7; i++)
  61.     {
  62.         int input;
  63.         cout << "Please enter number " << i + 1 << ":" << endl;
  64.         cin >> input;
  65.        
  66.         while(input < 1 ||input > 40)
  67.         {
  68.             cout << "The number must be between 1 and 40. Please enter another number" << endl;
  69.         }
  70.     }
  71. } // End of genLottoPicks Function
  72.  
  73. //NEED TO TEST FOR IF ENTER NUMBER IS NOT 1 OR Q
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement