Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Valentin Tsoy
- CS1, Section 121
- Assignmen 5, Problem 1
- This program will model the Littleton City Lotto
- (not a real Lotto game). The program is going to allow to user to first select their lotto
- numbers. The program will then randomly generate the winning lotto numbers for the
- week and then check the winning numbers against the random ticket the user played in
- the Lotto to see how many numbers the user guessed correctly.
- -------------------------------Psuedocode-------------------------------
- 1. Data Given:
- -
- 2. Data Needed:
- -
- 3. Calculations:
- -
- 4. Print results
- -
- ----------------------------End of Psuedocode---------------------------
- */
- #include <iostream>
- #include <iomanip>
- using namespace std;
- // Prototype Functions
- void getLottoPicks(int * pUserTicket);
- int main ()
- {
- // Variable Declaration
- int choice;
- char user_name;
- const int SIZE = 7; // Constant for for the number of inputs
- int UserTicket [SIZE]; // Declare Array
- cout << "LITTLETON CITY LOTTO MODEL:" << endl;
- cout << "---------------------------" << endl;
- cout << "1) Play lotto" << endl;
- cout << "Q) Quit" << endl;
- cout << "Please make a seletion: " << endl;
- cin >> choice;
- if(choice == 1)
- {
- cout << "Please enter your name: " << endl;
- cin >> user_name;
- }
- // Calling Functions
- getLottoPicks(UserTicket);
- return 0;
- } // End of Main Function
- void getLottoPicks(int * pUserTicket)
- {
- for (int i = 0; i < 7; i++)
- {
- int input;
- cout << "Please enter number " << i + 1 << ":" << endl;
- cin >> input;
- while(input < 1 ||input > 40)
- {
- cout << "The number must be between 1 and 40. Please enter another number" << endl;
- }
- }
- } // End of genLottoPicks Function
- //NEED TO TEST FOR IF ENTER NUMBER IS NOT 1 OR Q
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement