Question
- write this program in c++ programming: Generate three random numbers: one between 1 and 10, a second between 11 and 20, and a third
- write this program in c++ programming:
Generate three random numbers: one between 1 and 10, a second between 11 and 20, and a third between 21 and 30.
Use meaningful variable names such as lottery1, lottery2, and lottery3.
1. Prompt (ask) the user for their three lottery numbers: one between 1 and 10, a second between 11 and 20, and a third between 21 and 30.
2.Determine if the users lottery numbers are within range the first should be between 1 and 10, the second between 11 and 20, and the third between 21 and 30 (you must use just ONE ifstatement with a compound condition to check this). If not, output their numbers were invalid and do not continue. If they are all within their ranges, continue onto step 3
3.Determine if the user is winner. You must use a compound condition in the if-statements:
a. If all three numbers are correct (i.e., their first number is the same as the first lottery number you generated, their second the same as the second lottery number, and their third the same as the third lottery number), they win $1,000
b. If one or two of their numbers are correct, but not all three, they win $100.
c. If none of their numbers are correct, they do not win anything.
7. Output the result (See sample output below)
a. The 3 lottery numbers
b. Whether or not the user is a winner, if a winner, the dollar amount of their winnings
-------------------------------------------------------
Sample output :
Enter your first lottery number between 1 and 10: 7
Enter your second lottery number between 11 and 20: 20
Enter your third lottery number between 21 and 30: 31
Your lottery numbers are not in the correct range! >>
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started