1 answer

I need help with a C++ assignment:

Write a program containing the following:

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.

7. If the DieRoll added to the Guess is greater than or equal 10 and DieRoll is even Display **“YOU ARE A LUCKY PERSON”**. This is unrelated to the previous requirements.

8. Create a **for** **loop** to print the numbers 1 thru 5, all on the same line.

9. On the next output line create a **for** **loop** which will count backwards by 1’s from 100 to 0 (inclusive of 100 and 0) only displaying every number which is evenly divisible by 17.

10. Write a **while** **loop** to do the same as 9.

11. Write a **do…while loop** to:

a. ask the user for a number ( use the variable Guess).

b. get user input.

c. tell the user the remainder of dividing the number by 5 (modulo) even if result is 0.

d. continue the loop until the user enters zero (0) as the number. (Make sure the user is aware of this.)

Organize the loop like this (this is a planning technique called pseudocode):

do

{

prompt the user for a # (a. above)

get user input (b. above)

output to user (c. above)

}while (your test goes here to see if the number is 0);

12. Create a **for loop within a for loop.** The outer loop will count from 1 to 5. The inner loop will count from 1 to 6 and write the product of the outer loop counter multiplied by the inner loop counter, all on the same line with one tab (‘\t’) between. Between the loop ends put a line feed (endl or \n). The result should look like this:

1 2 3 4 5 6

2 4 6 8 10 12

3 6 9 12 15 18 etc,

1 answer
#####
2 hours 13/50 Pens and pencils are substitutes. The price of pens drops by 15%. How...

2 hours 13/50 Pens and pencils are substitutes. The price of pens drops by 15%. How does this affect the market for pencils? In the graph below, show how the market for pencils is impacted by this change by shifting the appropriate curve. Provide your answer below: Price of Pencils Supply Next > ...

1 answer
#####
A 1.0 mm -diameter, 20 cm -long copper wire carries a 4.5 A current. What is...

A 1.0 mm -diameter, 20 cm -long copper wire carries a 4.5 A current. What is the potential difference between the ends of the wire?...

1 answer
#####
Basic Physics PHY 114 W-01 Department of Physical and Computer Sciences Medgar Evers College Assignment 2...

Basic Physics PHY 114 W-01 Department of Physical and Computer Sciences Medgar Evers College Assignment 2 Name: Write or type work and solutions on a separate paper. If written, write legibly. 1. The velocity of a car decreases from 30 m/s to 18 m/s in a time of 1 minute. What is the average acceler...

1 answer
#####
We were unable to transcribe this imageTransaction 8 On March 1, fixtures and equipment were purchased...

We were unable to transcribe this imageTransaction 8 On March 1, fixtures and equipment were purchased for $4,500 with a downpayment of $1,500 and a $3,000 note, payable in one year. Interest of 4.5% per year was due when the note was repaid. The estimated life of the fixtures and equipment is 9 yea...

1 answer
#####
Discrete Math-Check my work please {(a,b) € NxN: on N is a Il show that the...

Discrete Math-Check my work please {(a,b) € NxN: on N is a Il show that the relation R= b = 2ra, kao integer partial ordering, R is a relation. INERA Since n-20 nrn So R is reflepise. Iff nRm and mRn, then n=2km and m=2 sn. no 2lk15) Kts=0 Kss=o, so nom, hence Ris anti-symmetric If nRm and ...

1 answer
#####
Trevor's Grout Company produces and sells grout to clients so they can install tile in their...

Trevor's Grout Company produces and sells grout to clients so they can install tile in their new homes. Trevor has supplied the following data about his grout company: Kilograms (of grout) produced and sold 340,000 Sales revenue $ 1,910,000 Variable manufacturing expense $ 956,000 ...

1 answer
#####
Suppose the prices of one-year, two-year, and three-year zero coupon bonds each with a par value...

Suppose the prices of one-year, two-year, and three-year zero coupon bonds each with a par value of $100 are $90, $80, and $70, respectively. Compute the three spot rates....

1 answer
#####
A heat engine generates 500 kW of work while rejecting 580 kW of heat into a...

A heat engine generates 500 kW of work while rejecting 580 kW of heat into a nearby lake. The thermal efficiency of the heat engine is closest to:...

1 answer
#####
U INQUIZITIVE Chapter 33: International Finance Page(s) 1084-1085 33.3. What causes trade deficits? Calculate the current...

U INQUIZITIVE Chapter 33: International Finance Page(s) 1084-1085 33.3. What causes trade deficits? Calculate the current account balance if a small country exports $200 million in goods and services and imports $160 million, it receives $80 million in foreign aid and private charity (net), it pays ...

1 answer
#####
Step by step please. box in answer. 3. ÷, 0-10 points l Previous Answers SerPSEI0 11...

step by step please. box in answer. 3. ÷, 0-10 points l Previous Answers SerPSEI0 11 1P003 My Notes Ask Your Teacher If I, X -TE, what is the angle between Ã and ? Your response differs from the correct answer by more than 100%...

1 answer
#####
How not teaching patients of how to clean their teeth will affect my professional life as...

how not teaching patients of how to clean their teeth will affect my professional life as a dental hygienist...

1 answer
#####
Please help me! You have identified a new transporter involved in the movement of sodium and...

Please help me! You have identified a new transporter involved in the movement of sodium and calcium. Describe an experiment to determine whether this transporter is a pump or a secondary transporter. –Key difference: A pump requires energy that is not coupled to a concentration gradient. Seco...

1 answer
#####
Conclusion topic: Describe how we know that molecules actually have the shapes that you have described...

Conclusion topic: Describe how we know that molecules actually have the shapes that you have described in this experiment. Also, if we have a molecule that has resonance, like ozone, how do we know that the bonds are actually not purely single bonds or purely double bonds (HINT: think bond lengths!)...

1 answer
#####
You are given a PM as shown below: START READ READ2 ACCEPT b ADD a READ...

You are given a PM as shown below: START READ READ2 ACCEPT b ADD a READ ADD Using the approach discussed in the lecture video or follow the example in the textbook from page 459 to page 461, trace the paths of the following input strings on this PM: "aabbbb". At every step, name the current ...

1 answer
#####
5. You observed that the time your friend Alice talks on a phone conversation is exponentially...

5. You observed that the time your friend Alice talks on a phone conversation is exponentially distributed with mean 5 minutes. You call her one morning and her line is busy. Assuming that she is in a phone conversation: (a) (8.5 pts) What is the probability that she would finish the conversation in...

1 answer
#####
6. Calculate AH Reaction for the Reaction: N2H4 + 2N2O5 + 2HNO3 + 2NO2 + 2...

6. Calculate AH Reaction for the Reaction: N2H4 + 2N2O5 + 2HNO3 + 2NO2 + 2 NH Using the following equations: H2 + 2N2 + 5022HNO3 + 2NO2 N2H4 + 2NH + H2 2N205 2N2 + 502 AH = -202 kJ AH = +567 kJ AH = +22.6 kJ 7. Calculate the AHReaction for the reaction 2H2(g) + CO(g) → CH3OH(1) Using the follow...

1 answer
#####
Consider the system shown in the figure (Figure 1) with MA = 7.5 kg and mB...

Consider the system shown in the figure (Figure 1) with MA = 7.5 kg and mB = 11.0 kg. The angles QA = 59. and OB = 32. a) In the absence of friction, what force F would be required to pull the masses at a constant velocity up the fixed inclines? MB CB = 32° b) The force Fº is now removed. W...

1 answer
#####
Completeness and clarity 2. Find a particular solution for the IVP y" - 2y + 2y...

completeness and clarity 2. Find a particular solution for the IVP y" - 2y + 2y = 8(t - 5), y(0) = 0, y0) = 1...

1 answer
#####
Computer Sciences

Q#1: Your team is asked to develop criticalsoftware of health insurance system, as the project is complex andsensitive related to the Insurance ofhealth so there is no chanceof error. If the size of the project is 33200LOC then calculate the“Effort” in personmonth, and“Time”...