Create a simple lottery program using C. A user will input four integer values between 0...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Create a simple lottery program using C. A user will input four integer values between 0 and 9. Your program will then randomly generate four random integer numbers and compare them with the user's inputs. Use a two-dimensional array to store all numbers, i.e. user inputs in column 1 and computer generated numbers in column 2 of the array. Your program should also prompt user to re-enter the value if it exceeds 9. Likewise, if the input is less than 0, your program should also prompt for re-entry. Declare "Win" if at least two consecutive computer generated numbers are the same as user's inputs. If all the four numbers are the same, then declare "Strike. Otherwise, "Loose". See Figure 4 for sample execution and output. Activate Enter an integer value between and 9 2 Enter an integer value between 0 and 9: 9 Enter an integer value between and 9: 19 3 Invalid input. Integer should be between and 9 only. Try again. Enter an integer value between 0 and 9 Enter an integer value between Your input numbers are 293 6 and 9: 6 Computer generated numbers are 1 8 1 7 *********** RESULTS ***************** Loose Figure 4: Sample lottery program output. Create a simple lottery program using C. A user will input four integer values between 0 and 9. Your program will then randomly generate four random integer numbers and compare them with the user's inputs. Use a two-dimensional array to store all numbers, i.e. user inputs in column 1 and computer generated numbers in column 2 of the array. Your program should also prompt user to re-enter the value if it exceeds 9. Likewise, if the input is less than 0, your program should also prompt for re-entry. Declare "Win" if at least two consecutive computer generated numbers are the same as user's inputs. If all the four numbers are the same, then declare "Strike. Otherwise, "Loose". See Figure 4 for sample execution and output. Activate Enter an integer value between and 9 2 Enter an integer value between 0 and 9: 9 Enter an integer value between and 9: 19 3 Invalid input. Integer should be between and 9 only. Try again. Enter an integer value between 0 and 9 Enter an integer value between Your input numbers are 293 6 and 9: 6 Computer generated numbers are 1 8 1 7 *********** RESULTS ***************** Loose Figure 4: Sample lottery program output.
Expert Answer:
Answer rating: 100% (QA)
include stdio h include stdlib h include time h int main int userNumbers4 int computerNumbers4 int i ... View the full answer
Related Book For
Introduction To Java Programming And Data Structures Comprehensive Version
ISBN: 9780136520238
12th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
How are the square numbers embedded in Pascals triangle?
-
This graph shows the Kangaroo Company's production costs and revenue for its pogo sticks. Use the graph to estimate the answers to the questions below. a. If 25 pogo sticks are sold, will the company...
-
If a subordinate came to you and said that they felt the company's new diversity hiring initiative was unfair and would compromise their well-deserved opportunities for advancement, how would you...
-
Select a publicly traded company or use a company assigned by your instructor. Using the firms most recent Form 10-K report (accessed through the SEC EDGAR database or from the companys website),...
-
1. What might Stanley have meant when he said that by agreeing to go quietly, he provided a benefit to the company? 2. Stanley argued that he was not an insider because he was no longer employed by...
-
How does MariaDB leverage optimizer enhancements such as Cost-Based Optimization (CBO), Index Condition Pushdown (ICP), and Histogram-Based Statistics to improve query execution efficiency and plan...
-
1. Explain why mass markets require offerings with fewer distinctions than niche markets. 2. What is the difference between a niche and a market segment? 3. How is McKennas philosophy of market...
-
Which one these two is one of the most important degrees of freedom in production control? lot size setup tme
-
Which of these generations has a significant influence on the technology purchases of their parents and caregivers? OA. Millennials B. Baby boomers C. Generation Alpha OD. Generation X O E....
-
23% -7. Which one of the following is an example of mentally filling in the gaps in other people's behaviour to meet your expectations? (A) Remembering only the points you agree with, no matter who...
-
Mass customization is the process by which firms interact one-to-one with masses of customers to design products and services tailor-made to individual needs O a. False O b. True
-
Consider two non-conducting straight wires, each of length a and uniform charge density , lying in the xy plane running parallel to the x axis. One wire runs from point (-a/2, a/2,0) to (a/2, a/2,0)....
-
Write a brief note on Securities Investments in which you address the following: Provide all types of security investments. Also provide the pros and cons of each type of investments along with the...
-
What is EBIT/eps analysis? What information does it provide managers?
-
If you invest $5,000 three years from now, how much will be in the account 15 years from now if i = 10 percent compounded annually? a. $8,053 b. $15,692 c. $20,886 d. $27,800
-
Under what circumstances are the effective annual interest rate and the period interest rate equal? a. Never true b. If the number of compounding periods per year is 1 c. If the number of compounding...
-
If you want to triple your money at an interest rate of 6 percent per year compounded annually, how many years would you have to leave the money in the account? a. 12 years b. 19 years c. 32 years d....
Study smarter with the SolutionInn App