Write a C++ program that simulates a lottery game.
Your program should use functions and arrays.
Define two global constants:
- ARRAY_SIZE that stores the number of drawn numbers (for example 5)
-MAX_RANGE that stores the highest value of the numbers ( for example 9 )
The program will use an array of five integers named lottery, and should generate a random number in the range of 0 through 9 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 match.
For example:
Lottery array: 7 4 9 1 3
User array : 4 2 9 7 3
There are two matching digits (elements 2 and 4).
The program should display the random numbers stored in lottery array and the numbers chosen by the user and then give the number of matching digits. If all digits match, display a message proclaiming the user a grand prize winner.
#include<iostream>
#define ARRAY_SIZE 5
#define MAX_RANGE 10
using namespace std;
int main(){
int arr[ARRAY_SIZE];
int lottery[ARRAY_SIZE];
for(int i=0;i<ARRAY_SIZE;i++)
lottery[i]=rand()%MAX_RANGE;
cout<<"Enter "<<ARRAY_SIZE<<" elements: ";
for(int i=0;i<ARRAY_SIZE;i++)
cin>>arr[i];
int count=0;
for(int i=0;i<ARRAY_SIZE;i++)
if(arr[i]==lottery[i])
count++;
cout<<"Lottery :";
for(int i=0;i<ARRAY_SIZE;i++)
cout<<lottery[i]<<" ";
cout<<endl;
cout<<"User :";
for(int i=0;i<ARRAY_SIZE;i++)
cout<<arr[i]<<" ";
cout<<endl;
if(count==ARRAY_SIZE){
cout<<"Congratulations... grand prize winner";
}
else{
cout<<"There are "<<count<<" matching digits" ;
}
}

Write a C++ program that simulates a lottery game. Your program should use functions and arrays....
in a c++ visual studio 2017 ...Write a program that simulates a lottery. The program should have an array of five integers named lottery and should generate a random number in the range 0 through 9 for each element in 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 element in the two arrays and keep a count of the digits that match. 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...
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...
Write a Lottery class that simulates a 6-number lottery (e.g. "Lotto"). The class should have an array of six integers named lotteryNumbers, and another array of six integers named userLotteryPicks. The class' constructor should use the Random class to generate a unique random number in the range of 1 to 60 for each of the 6 elements in the lotteryNumbers array. Thus, there should be a loop that keeps generating random numbers until all 6 numbers are unique. The Lottery class...
In C... Write a program to simulate a pick-5 lottery game. Your program must generate and store 5 distinct random numbers between 1 and 9 (inclusive) in an array. The program prompts the user for: an integer random seed five distinct integers between 1 and 9 (which are stored in another array) The program then compares the two arrays to determine if they are identical. If the two arrays are identical, then the user wins the game. otherwise the program...
In C program #include<stdio.h> Write a program to simulate a pick-5 lottery game. Your program must generate and store 5 distinct random numbers between 1 and 9 (inclusive) in an array. The program prompts the user for: an integer random seed five distinct integers between 1 and 9 (which are stored in another array) The program then compares the two arrays to determine if they are identical. If the two arrays are identical, then the user wins the game. otherwise...
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...
COP2221 - Intermediate C++ Programming Module #6 Assignment One 20 points This assignment refers to Learning Outcome #2: Create and utilize arrays to store lists of related data Programming Problem You have been hired to create a C++ program to simulate the lottery. Your program allows users to see how often their lottery number choices match a randomly generated set of numbers used to pick lottery winners. The company, "How Lucky Are You?, Inc." wants a modular, professional and user-friendly...
Develop a system flowchart and then write a menu-driven C++ program that uses user-defined functions arrays, and a random number generator. Upon program execution, the screen will be cleared and the menu shown below will appear at the top of the screen and centered. The menu items are explained below. Help Smallest Quit H or h ( for Help ) option will invoke a function named help() which will display a help screen. The help screen(s) should guide the user...
Create a Lottery application in Android Studio that simulates a lottery game. The application should allow the play to type in number to generate five numbers and one red ball. The constructor should use the Random class to generate a random number in the range of 1 through 69 for the red ball 1 through 26. In Android Studio