Write a c program that simulates a lottery game

Assignment Help Basic Computer Science
Reference no: EM132493668

Write a C++ program that simulates a lottery game. The program must include functions and arrays.

The program must include two global constants:

- ARRAY_SIZE: that stores the number of drawn digits for the lottery, which is 5

- MAX_RANGE: that stores the highest value possible for the digits, which is 9

The program must have the two mandatory arrays (more arrays are welcome if needed):

- LOTTERY: that has an index of five integers and generates a random number in the range of 0 through 9 for each element of the array

- USER: that stores the five integers the user will input

The program must have a function that compares the lottery's generated digits with the user's inputted digits. The function will keep count of how many matches are found (ORDER OF THE DIGITS MATTER). If all digits match, the program will display a message proclaiming that the user is a winner.

For example:

Lottery array: 7 4 9 1 3

User array: 4 2 9 7 3

There are two matching digits (digits 9 and 3 --> positions 3 and 5) as the user guessed two of the correct numbers of the lottery's digits.

The program should display the random numbers stored in the lottery array, the numbers chosen by the user, and then give the number of matching digits.

Reference no: EM132493668

Questions Cloud

How much should be recorded as Goodwill : Accounts Receivable assumed by buyer $135,000. Using this information, how much should be recorded as Goodwill for this transaction
Minimize the decrease in prot : How should the production of the three types of couches be adjusted to minimize the decrease in prot? Formulate this problem as a linear programming problem.
What is maximum price should be willing to pay for bond : If you require an 11.9% nominal yield to maturity on this investment, what is the maximum price you should be willing to pay for the bond?
What is the firms expected rate of return : What is the firm's expected rate of return? Rock company's stock has a 20% chance of producing a 30% return, a 68% chance
Write a c program that simulates a lottery game : Write a C++ program that simulates a lottery game. The program must include functions and arrays.
Compare qualitative v quantitative risk assessment : Compare and evaluate in 500 words or more 'qualitative' v 'quantitative' risk assessment. Use at least three sources. Include at least 3 quotes from your.
Compute what is the required rate of return on the market : Mulherin's stock has a beta of 1.44, its required return is 9.90%, and the risk-free rate is 2.35%. What is the required rate of return on the market?
Design a program that reads the file and displays : Design a program that reads the file and displays the lowest and highest gas prices, as well as the dates for those prices.
What is the stock expected dividend yield for coming year : If D0 = $1.561, constant) growth rate= 5.7%, and P = $39.00, Determine what is the stock's expected dividend yield for the coming year?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Keep track of process information

What data structure is used by an operating system to keep track of process information? Explain

  How many copies of the software should i attempt to sell

A Consulting Company currently enjoys a patent on software that estimates economic damages for clients involved in personal injury lawsuits.

  Develop a prototype to display the financial results

Develop a prototype to display the financial results of a public company

  Probability distribution for the random variable

Next 6 questions (1-6) are based on the following: The following table is a probability distribution for the random variable x. f(x = 35) is left blank

  What was the maximum height achieved by this balloon

Use sigma notation to represent the height of the balloon above the ground after one hour. Then calculate the total height of the balloon after one hour to the nearest foot.

  Two variables amessage and pmessage

I. What is the difference between the two variables amessage and pmessage?

  What is the most common requirement gathering

What is the most common requirement gathering technique in the analysis stage of an SDLC?

  Discrimination better for the producer

Why is price discrimination better for the producer than a standard price? Pick any reasonable one price for all and examine if the revenue would be higher.

  The cpu fetch-execute cycle

A von Neumann machine has a random-access memory and each successive operation can read or write any memory location, independent of the location accessed by the previous operation and also has a CPU with one or more registers that hold data that are..

  What is the difference between the definitions of measures

What kind of measurement scales (ratio, interval, etc.) characterizes the following software measures.

  Can you find rules that have interesting behavior

Create a SETUP button to initialize your model and a GO button to run it. In your write-up of the model, make sure to explicitly describe the rules the agents are following. Try running the model in different ways. What set of parameters gives you..

  Annual compensation of a salesperson

Write the Java® application, using NetBeans IDE, that calculates the total annual compensation of a salesperson.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd