Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ program I only need help with numbers 1-7, I can not put loops in the program just yet. I am confused also on where

C++ program

I only need help with numbers 1-7, I can not put loops in the program just yet. I am confused also on where I put #include iomanip;, do I put it where #include iostream; would go?

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, displayWINNER 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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MFDBS 89 2nd Symposium On Mathematical Fundamentals Of Database Systems Visegrad Hungary June 26 30 1989 Proceedings

Authors: Janos Demetrovics ,Bernhard Thalheim

1989th Edition

3540512519, 978-3540512516

More Books

Students also viewed these Databases questions

Question

Express this concentration in terms of ppm: 0.0345%

Answered: 1 week ago

Question

Technology. Refer to Case

Answered: 1 week ago