Question: #include #include #include #include using namespace std; #include int* numbers(int num[]) { for (int i = 0; i < 6; i++) { num[i] = (rand()

#include #include #include #include using namespace std; #include

int* numbers(int num[]) { for (int i = 0; i < 6; i++) { num[i] = (rand() % 69 + 1); } sort(num, num + 6); for (int i = 0; i < 6; i++) { if (num[i] == num[i + 1]) { num[i] = (rand() % 69 + 1); } } sort(num, num + 6); num[5] = (rand() % 26 + 1); cout << endl; return num; }

int main() { srand(time(0)); int lottery[6]; int* p; int n; string x; cout << "would like to play Y or N "; cin >> x; while(x != "n"){ cout << "how many winning numbers would like to see? "; cin >> n; for(int i = 0; i < n; i++){ p = numbers(lottery); cout << "Your winning numbers are: "; for (int i = 0; i < 5; i++) { cout << *(p + i) << " "; } cout << "your power ball is " << *(p + 5); } cout << endl << "would like to play Y or N "; cin >> x; } }

Explein every single step of this code and every single function.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!