Advertisement
Guest User

Untitled

a guest
Feb 25th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.26 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3. #include <cstdlib>
  4. using std::cout; using std::endl; using std::cin;
  5. const int size = 10;
  6.  
  7. void assign(int wins[]);
  8. bool check(int wins[], int num);
  9. void draw(int wins[]);
  10. void entry(int userInput);
  11. void printOut();
  12.  
  13.  
  14. main() {
  15.     //declare array and other variables
  16.  
  17.         //assign(...) // fill array with 0
  18.         //draw(...)       // select 10 non-repeating random numbers
  19.         //entry(...)      // get user input
  20.         //use check() to compare user input against lottery numbers
  21.         //and output whether user won
  22.         //printOut(...)   // outputs seleced lottery numbers
  23. }
  24.  
  25. void assign(int wins[]) {
  26.     for (int i = 0; i < size; i++) {
  27.         wins[i] = 0;
  28.     }
  29. }
  30.  
  31. bool check(int wins[], int num) {
  32.    
  33.     for (int i = 1; i < size; ++i) {
  34.         if (num == wins[i]) {
  35.             return true;
  36.         }
  37.         else if (num != wins[i]) {
  38.             return false;
  39.         }
  40.     }
  41. }
  42.  
  43. void draw(int wins[]) {
  44.  
  45.     int numOfNum = 0;
  46.     int ranNum;
  47.  
  48.     while (numOfNum < size) {
  49.         srand(time(nullptr));
  50.         ranNum = (rand() % 1000) + 1;
  51.         int num = ranNum;
  52.         if (check(wins[], num) == false) {
  53.             numOfNum++;
  54.          }
  55.         }
  56.    
  57.    
  58. }
  59.  
  60. void entry(int userInput) {
  61.    
  62.     cout << "Enter a number from 1 to 1000: ";
  63.     cin >> userInput;
  64.  
  65. }
  66.  
  67. void printOut() {
  68.  
  69.     cout << "The lottery numbers are: ";
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement