
C++ 1 Program 2.
Name: CPP12.CPP
Write a program containing the following: Identify the program with your name and class meeting time. Place a comment, properly indented, before each of the 7 points below. Chapter 5 will add to this program.
1. Variable Definitions only as (DieRoll, Guess, cnt1, cnt2) followed by this statement:
srand((unsigned int)time (NULL));
which will give the random number generator a random starting point.
Note: srand and rand require the TIME.H (or iomanip)
cnt1 and cnt2 will be used in Chapter 5 drop box as counters for loops. Do NOT create additional variables. Points will be taken off for any additional variable creation.
2. Prompt the user for a whole number between 1 and 6.
3. Accept user input of the number – use Guess as the variable
4. Simulate rolling a die with the following code (DieRoll variable is defined in 1):
DieRoll = rand()%6+1; //Note: rand is a function returning 0 thru 32767.
5. Display Guess and DieRoll on the Screen with good user labeling information. Additionally, display”WINNER” if Guess and DieRoll are equal.
6. Display “DOUBLE WINNER” if DieRoll is an odd number (use modulo). Not related to question 5 above. NOT an if else...
7. If the DieRoll added to the Guess is greater than or equal to 10 and DieRoll is even Display “YOU ARE A LUCKY PERSON”. This is unrelated to the previous requirements. NOT an if else...Make this a complex if test. NOT nested if statements.
We will add loops when we get to Chapter 5 to this program.

Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 3 images

- Program Purpose - Professional Athletes often hire other professionals to help take care of matters for them. We will group them in four categories: Lawyers, Personal Assistants, Agents, and Trainers. They all get paid a percentage of the athlete's total yearly salary. Lawyers - 10%, Personal Assistants - 3%, Agents - 7%, and Trainers - 5% . Prompt the user to enter the athlete's salary for the year (ensure that the entered value is positive). The user should then enter the name and category of each of the hired professionals. The athlete should be able to hire as many professionals in each category as he/she wants, even if it is more than he/she can afford. Based on the category, calculate the amount that each professional should be paid. After all data has been entered, print the names of each professional hired, how much each is being paid, the total amount the athlete paid, and how much the athlete has left.arrow_forwardVoid functions do not return any value when they are called.True or falsearrow_forwardCoin Toss Write a function named coinToss that simulates the tossing of a coin. When you call the function, it should generate a random number in the range of 1 through 2. If the random number is 1, the function should display "heads". If the random number is 2, the function should display "tails". Demonstrate the function in a program that sks the user how many times the coin should be tossed and the coin then simulates the tossing of the coin that number of times.arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY





