Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #include <cstdlib>
- using std::cout; using std::endl; using std::cin;
- const int size = 10;
- void assign(int wins[]);
- bool check(int wins[], int num);
- void draw(int wins[]);
- void entry(int userInput);
- void printOut();
- main() {
- //declare array and other variables
- //assign(...) // fill array with 0
- //draw(...) // select 10 non-repeating random numbers
- //entry(...) // get user input
- //use check() to compare user input against lottery numbers
- //and output whether user won
- //printOut(...) // outputs seleced lottery numbers
- }
- void assign(int wins[]) {
- for (int i = 0; i < size; i++) {
- wins[i] = 0;
- }
- }
- bool check(int wins[], int num) {
- for (int i = 1; i < size; ++i) {
- if (num == wins[i]) {
- return true;
- }
- else if (num != wins[i]) {
- return false;
- }
- }
- }
- void draw(int wins[]) {
- int numOfNum = 0;
- int ranNum;
- while (numOfNum < size) {
- srand(time(nullptr));
- ranNum = (rand() % 1000) + 1;
- int num = ranNum;
- if (check(wins[], num) == false) {
- numOfNum++;
- }
- }
- }
- void entry(int userInput) {
- cout << "Enter a number from 1 to 1000: ";
- cin >> userInput;
- }
- void printOut() {
- cout << "The lottery numbers are: ";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement