Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PLEASE NOTE, be sure that you run the program several times to make sure you are

ID: 3906384 • Letter: P

Question

PLEASE NOTE, be sure that you run the program several times to make sure you are randomizing the numbers each time you run the program. There is a chance that you could run the program several times and get the same number. You must randomize each draw of the numbers. Please see my program below. I ran the program 3 times so you can see the different drawings of the numbers Good Luck! Hey, if you get it working, maybe you can use it to play Powerball and win that Million. Maybe you will get lucky by having your program pick the numbers for you.

Explanation / Answer

here is your program : ----------->>>>>>>>

#include<iostream>
#include<cstdlib>
#include<ctime>

using namespace std;

void drawNumber(int *number,int &powerball){
srand(time(0));
int st;
for(int i = 0;i<5;i++){
  if(i == 0){
   number[i] = rand()%60;
  }else{
   st = 1;
   while(st != 0){
    number[i] = rand()%60;
    st = 0;
    for(int j = 0;j<i;j++){
     if(number[j] == number[i]){
      st = 1;
      break;
     }
    }
   }
  }
}

powerball = rand()%35 +1;
}

int main(){
int *number = new int[5];
int powerball = 0;
drawNumber(number,powerball);
cout<<" The new game numbers : ";
for(int i = 0;i<5;i++){
  cout<<number[i]<<" ";
}
cout<<" Powerball number: "<<powerball;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote