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

  Calculation the distance and time printed on the screen

After each calculation the distance and time printed on the screen and accumulated to the sum of the total distance and sum of the total time. The current destination should be saved as the old postion for the next calculation

  C++ programming uml diagrams

The goal of this lab is to better familiarize you with polymorphism and the factory design pattern, two key components in Assignment

  Program to calculate word ladders where single-character

Write down a program in C++ to calculate word ladders where single-character substitutions have the cost of 1, and single-character additions or deletions.

  By a minimal interpretation that makes a formula

By a minimal interpretation that makes a formula true, we mean that if one atom is removed from the interpretation then the resulting interpretation does no longer make the formula true.

  Implement a function to recursively

Implement a function to recursively determine if a word is a palindrome. A palindrome is a word, phrase, number, or other sequence of symbols or elements, whose meaning may be interpreted the same way in either forward or reverse direction.

  Prevent illegal moves without crashing

Your program must gracefully handle the case when a player tries to add a non-number to a square, or add a number that violates the Sudoku rules. It should prevent illegal moves without crashing.

  Initialize an array and fill the array with the gpa values.

Write a program in java that asks user input (using a loop) for name of 10 student and the corresponding grade point averages (GPAs). Initialize an array and fill the array with the GPA values.

  Compute the average of an array of n 8-bit numbers

Write a program to compute the average of an array of N 8-bit numbers and store the result at $1000. The array is stored at memory locations starting from $1010. N is no larger than 255.

  Write in c++. read an inputfile.txt

write in C++.  read an inputFile.txt which contains integers that are virutal addresses, and I am suppossed to translate that into physical addresses using a page table and a transition lookaside buffer

  State a c program that opens the file

Write a C program that opens the file and firstly stores all the values in an appropriately declared two-dimensional array of integers. It then should analyse this array to find (from the 40 input values) the total number of coursework marks in the..

  Allow single play a simple two dice game of chance against

Write a program that allows a single Player (the user) to play a simple two dice game of chance against

  Implement the default constructor

Implement the default constructor and the constructors with one and two int parameters. The one parameter constructor should initialize the first member of the pair; the second member of the pair is to be 0.

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