c++ please help
You are going to create a PowerBall Lottery game with functions. First, you are going to generate 5 UNIQUE numbers between 1 and 69. Then you are going to generate the powerball number, which is a number between 1 and 26. Next you are going to ask the user for 5 numbers. Users should only be allowed to enter numbers in the range 1-69 for regular numbers, 1-26 for powerball pick. You will compare each of the user's numbers to the numbers chosen for the lottery. Then you are going to ask the user for their powerball number guess. You will compare the value of the user powerball number to the computer powerball number. You will output: the lottery numbers, the user numbers, and the number of powerball numbers the user picked correctly. You will output if the user got the powerball correct. You will use functions that have functional signatures given below: int randBetween(int min, int max) // calculate a random # between min and max int getValue() // returns a user entered value bool isSame(int newNumber, int number) // returns true if newNumber is the same as number bool isInBounds(int number, int min, int max) // returns true if the number is between min and max (inclusive) void printNumbers(int number1, int number2, int number3, int number4, int number5, int powerball) // prints the powerball and user numbers as 53 24 3 7 33 POWERBALL 5 Student Learning Outcomes: Use function prototypes to create functions Use functions Algorithm design Loops Conditionals Pass-by-copy



Formatting code in text:
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int randBetween(int min, int max); // calculate a random # between min and max
int getValue(); // returns a user entered value
bool isSame(int newNumber, int number); // returns true if newNumber is the same as number
bool isInBounds(int number, int min, int max); // returns true if the number is between min and max (inclusive)
void printNumbers(int number1, int number2, int number3, int number4, int number5, int powerball); // prints the powerball and user numbers as 53 24 3 7 33 POWERBALL 5
int main() {
// array for powerball nos
int lotteryNos[5];
int PowerBall;
// randomly generate unique power ball nos
srand(time(NULL));
int prevNumber = 0;
for (int i = 0; i < 5; i++) {
lotteryNos[i] = randBetween(1, 69);
if (isSame(lotteryNos[i], prevNumber))
i--;
prevNumber = lotteryNos[i];
}
PowerBall = randBetween(1, 26);
// ask user for numbers
int userNos[5], userPowerBall = 0;
cout << "Enter 5 numbers in range 1-69.\n";
int i = 0;
while (i < 5) {
int num;
cout << "Enter number: ";
cin >> num;
if (isInBounds(num, 1, 69)) {
userNos[i] = num;
i++;
}
else
cout << "Inavlid. Enter again.\n";
}
while(true) {
cout << "Enter powerball number (1-26): ";
cin >> userPowerBall;
if (isInBounds(userPowerBall, 1, 26))
break;
else
cout << "Invalid. Enter again.\n";
}
// check no of correct guess by user
int correctGuess = 0;
for (int i = 0; i < 5; i++) {
if (isSame(lotteryNos[i], userNos[i]))
correctGuess++;
}
// output the result of game
cout << "Output:\n";
cout << "The lottery numbers are: \n";
printNumbers(lotteryNos[0], lotteryNos[1], lotteryNos[2], lotteryNos[3], lotteryNos[4], PowerBall);
cout << "The user numbers are: \n";
printNumbers(userNos[0], userNos[1], userNos[2], userNos[3], userNos[4], userPowerBall);
cout << "User picked correctly: " << correctGuess << " numbers.\n";
if (isSame(PowerBall, userPowerBall))
cout << "You got the powerball correctly!!";
else
cout << "You didn't got the powerball!";
return 0;
}
// calculate a random # between min and max
int randBetween(int min, int max) {
int randNo = min + (rand() % (max - min + 1));
return randNo;
}
// returns a user entered value
int getValue() {
int number;
cin >> number;
return number;
}
// returns true if newNumber is the same as number
bool isSame(int newNumber, int number) {
return newNumber == number;
}
// returns true if the number is between min and max (inclusive)
bool isInBounds(int number, int min, int max) {
if (number < min || number > max)
return false;
else
return true;
}
// prints the powerball and user numbers as 53 24 3 7 33 POWERBALL 5
void printNumbers(int number1, int number2, int number3, int number4, int number5, int powerball) {
cout << number1 << " " << number2 << " " << number3 << " " << number4 << " " << number5<< " POWERBALL " << powerball << "\n";
}
Sample output:

c++ please help You are going to create a PowerBall Lottery game with functions. First, you...
Write a C++ program that simulates playing the Powerball game. The program will generate random numbers to simulate the lottery terminal generated numbers for white balls and red Powerball. The user will have the option to self-pick the numbers for the balls or let the computer randomly generate them. Set the Grand Prize to $1,000,000,000.00 in the program. Project Specifications Input for this project: Game mode choice – self pick or auto pick Five numbers between 1 and 69 for...
Using C++ create a lotto program Lottery Design a program that simulates a lottery. Requirements: The program should have an array of 5 integers named lottery and should generate a random number in the range of 1 through 99 for each element of the array. The user should enter five digits, which should be stored in an integer array named user. The program is to compare the corresponding elements in the two arrays and keep a count of the digits that...
Need help with assignment This assignment involves simulating a lottery drawing. In this type of lottery game, the player picks a set of numbers. A random drawing of numbers is then made, and the player wins if his/her chosen numbers match the drawn numbers (disregarding the order of the numbers). More specifically, a player picks k distinct numbers between 1 and n (inclusive), as well as one bonus number between 1 and m (inclusive). "Distinct" means that none of the...
c++ please help Create two arrays of 20 elements, called myArray1 and myArray2 Create a function randBetween that returns an integer between 2 integer inputs (int randBetween(int min, int max)); Fill the myArray1 with the random values. Loop thru the myArray1 and find the difference between the element i and element i + 1; put that difference in array2 example: array1 = {1, 3, 4, 5} array2 ends up having {-2, -1, -1} Loop thru myArray1 and find the min...
Please help to solve question 1 and subsections 1-4 1: Powerball Consider the multi-state lottery Powerball game. Each ticket is $2 and allows a player to select 5 white balls from 1 to 69 (without replacement), and 1 Red Powerball, from 1 to 26. The order of the five white balls does not matter when evaluating a win. If there are 64 losing whiteball numbers, how many ways can the winner pick 4 of them. If the player is only...
Guess My Number Create a mul5-func5on version of the Guess My Number game. Your game should generate a random number between 1 and 99, ask the user for a guess, and respond to each guess with correct, too high, or too low as needed. Once the user guesses the number correctly, report how many guesses it took and ask if they want to play again. You need to have at least the following three func5ons: displayInstruc5ons — no inputs, displays...
This is for a C# program. I would greatly appreciate any help!
Thank you:)
For this assignment you're going to create a console application called A02PBallGenerator. This app is going to mimic a quick pick program in a lotto terminal. When the user runs your app you're going to select the numbers for them. Then you'll ask them if they'd like another set of numbers. Y for yes and N for No Use a do while loop so that if...
I HAVE A PROBLE WITH THIS JAVA PROBLEM CAN ANYONE HELP ME
PLEASE.
Exercise 2 Write a program that simulates the Texas Powerball lottery. You will have to do research to find out how many numbers are drawn, and what the range(s) of the numbers are. For this exercise you need to create a class called "Powerbali", which exposes a public function called play'. This function accepts several parameters , which represent the individual numbers the player wants to play....
Write a C++ program that simulates a lottery. The user will select 5 numbers 0 through 9 and put this in an array. Then these user numbers are compared to the random numbers the computer generated. The program will display both the computer random number and below the user selected numbers. The program will tell the user how many matches are made. If the user guesses all five you let them know they are the grand winner. Here is the...
Lottery Game (15 Numbers). Design and implement a C++ program that generates 15 random non-repeating positive integer numbers from 1 to 999 (lottery numbers) and takes a single input from the user and checks the input against the 15 lottery numbers. The user wins if her/his input matches one of the lottery numbers. Your implementation must have a level of modularity (using functions) Functions you need to implement: Define function initialize() that takes array lotterNumbers[] as a parameter and assigns...