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
-
Part B - Users and Groups 1. Using the most appropriate tools for the task, create the following local user accounts and groups on your server: Group Name Teams Sponsors Council Description FIFA Team...
-
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?
-
The equations s1 = 18 + 0.4m and s2 = 11.2 + 0.54m give the lengths of two different springs in centimeters, s1 and s2, as mass amounts in grams, m, are separately added to each. a. When are the...
-
Compute nonlinear least squares and generalized least squares estimates for a model with an \(A R(1)\) error.
-
Go to the Internet and peruse the AICPA's "Catch Me If You Can" online fraud game.
-
Gators, Inc., is considering a project that requires an initial investment of $2,000,000 and that will generate the following cash inflows for the next five years: Year Cash Inflow at End of Year 1...
-
For each of the following variables, please name the level of measurement : a) _______ the ethnic group to which a person belongs b) _ _ the number of times a mouse makes ...
-
A clinic focuses on three services: counseling for teens and young adults, smoking cessation, and counseling for young parents. An analyst has developed a forecast of the number of visits each group...
-
Simplify by using the dustributive law and combining like term. Simplify all coefficients completely . 4 h ( 2 h + 9 ) - 7 h ( 7 h - 5 )
-
A managerial accountant has a significant role in designing, developing, and implementing an effective activity-based costing system. A service company's executive managers need a huge amount of...
-
Please read the attached WSJ article and discuss manageral reponsibilities and liabilities on the logistics and transportation part of a business. Norfolk Southern Comes Under Scrutiny After Ohio...
-
What specific mediation techniques have been found most effective in resolving deep-seated conflicts within culturally diverse teams, and how do these techniques influence the overarching power...
-
Heidi is preparing her tax return for the year and is looking at ways to save on her tax bill. Heidi worked full time in the day and tended bar at night. Her daytime employer reported her income for...
-
A beam of mass 18 kg is held by a string which can hold a maximum tension of 350N. At what distance x can this string be placed before it breaks? string 1.4 m 5.0 kg
-
What is EBIT/eps analysis? What information does it provide managers?
-
Revise Listing 3.8, Lottery.java, to generate a lottery of a two-digit number. The two digits in the number are distinct. (Hint: Generate the first digit. Use a loop to continuously generate the...
-
Rewrite Programming Exercise 28.14 to enable the user to set an initial pattern of the 4 * 4 16 tails problem (see Figure 28.23a). The user can click the Solve button to display the solution, as...
-
Rewrite Exercise 37.1 using JSP. Data from Exercise 37.1 Write a servlet to display a table that contains factorials for the numbers from 0 to 10, as shown in Figure 37.25. Na 36 401 (a) (b)
-
On 1 May 19X7, D Wilson Ltd, 1 Hawk Green Road, Stockport, sold the following goods on credit to G Christie & Son, The Golf Shop, Hole-in-One Lane, Marple, Cheshire: Order No A/496 3 sets Boy Michael...
-
Rule up a petty cash book with analysis columns for office expenss, motor expenses, cleaning expenses, and casual labour. The cash float is 350 and the amount spent is reimbursed on 30 June. 19X7...
-
The following sales have been made by S Thompson Ltd during the month of June 19X9. All the figures are shown net after deducting trade discount, but before adding VAT at the rate of 10 per cent. You...
Study smarter with the SolutionInn App