Program to play lottery

Assignment Help C/C++ Programming
Reference no: EM13698113

Question: You need to make a program to play lottery.

The program randomly generates a Lottery of a three-digit number ( any number from 100 to 999), prompts the user to enter a three-digit number, and determines whether the user wins according to the subsequent rule:

a. If the user matches the lottery in exact order , the awards is $100,000.

b. If the user input matches the lottery digits, the awards is $50,000.

c. If two digit in the user input matches a digit in the lottery, the awards is $30,000.

d. If one digit in the user input matches a digit in the lottery, the awards is $10,000.

Sample solution:

The winning number is 865.

Your ticket is 865 then 100000

Your ticket is 686, or 568,.. all digits are right but not in order

You get 50000

Your ticket is 860, or 186 .. then 30000

Your ticket is 800, 706, 600.. just one digit much you get

10000

Else

0

Please execute the program to check errors. It must compile with no errors and follow the directions.  Thank you.

Reference no: EM13698113

Questions Cloud

Prepare the pseudo code for given algorithm : They alternate: dark, light, dark, light, and so on. You want to get all the dark disks to the right-hand end, and all the light disks to the left-hand end.
Show that if the statement is true : Show that if the statement P(n) is true for infinitely many positive integers, and the implication P(n+1) ---> P(n) is true for all n>=1, then P(n) is true for all positive integers.
Subsets of cardinality : Prove by induction that for every n >= 3, any set of cardinality n has exactly n(n-1)(n-2)/6 subsets of cardinality
Show what makes database connectivity so complex : Show what makes database connectivity so complex and what could be done to simplify it - Add in your discussion why it is utilized despite its complexity.
Program to play lottery : The program randomly generates a Lottery of a three-digit number ( any number from 100 to 999), prompts the user to enter a three-digit number, and determines whether the user wins according to the subsequent rule:
Use bcd to encode the decimal number : Find the decimal integer that corresponds to each interpretation and Perform the subsequent operations:
Create a floating point variable : Demonstrate with labels: 1) a math equation using integers and your variables); 2) using one of your variables, each of the assignment symbols
Find the proper syntax for plotting the graph : Find the proper syntax for plotting the graph of |x|+|y|=1 ranging from -1 to 1 - Hint: you do not need to create x and y.
2s complement representation : How would you take a decimal number and make it a word-length 2's complement representation?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a function sum3darray

Write a function sum3DArray. This function will take a three dimensional array of ints and add all the entries in the three dimensional array. Assume columns and rank are two constants already defined.

  Write c program to add two integers and prints out average

Write a C program that prompts for a variable number of integers, adds them up, and prints out the average. The user will enter either an integer to be averaged.

  Calculate and display the number of units of electricity

The manager of PG&E wants a program that calculates a customer's electric bill. He will enter the current and previous meter readings.

  Design in c a unix utility program gasp

Design in C a Unix utility program gasp. Command gasp [options] STRING FILE... must read listed files (FILE...) and copy each line from input to stdout if it contains STRING.

  Implementation of data member counter of type int

Write the implementation (.cpp file) of Counter class. Here is the full specification of the class: A data member counter of type int.

  Create a graphical calculator with buttons that can add

create a graphical calculator with buttons that can add subtract multiply divide - sin cos tan clear and modulus.write

  Write a program to print the permutation

Write a program to print the permutation that lexicographically precedes the given input permutation.

  Write a program that uses the following arrays empid an

write a program that uses the following arrays empid an array of seven long integers to hold employee identification

  Prepare a c program that has this description

n is an integer, >= 0. x points to the first element of an int array with n position. p points to the first element of another int array array, also with n position.

  Static field holds rent due date for an office

// static field holds rent due date for an office - // rents are due on the 1st

  What is the output of the corrected loop

What is the output of the loop as it is written and correct the syntax of the loop so that the logic of the corrected loop corresponds to the formatting of the original loop. What is the output of the corrected loop?

  Write a c program that declares an array alpha of 50

write a c program that declares an array alpha of 50 components of the type double. initialize that array so that the

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