Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Problem 2 (5 points): diceSum Write a function diceSum which takes one integer argument for a desired sum. The function repeatedly rolls two six-sided

C++image text in transcribed

Problem 2 (5 points): diceSum Write a function diceSum which takes one integer argument for a desired sum. The function repeatedly rolls two six-sided dice until their sum is the desired sum. o Your function MUST be named diceSum . Your function takes one integer argument for the desired sum . Your function should not return anything. . If the desired sum is not between 2 and 12 (inclusive), then print the following message and does not roll the dice. The desired sum should be between 2 and 12 The function prints for each roll in the following output . You rolled a and a The function prints following message once we got the desired sum . Got a in rolls! Make sure that the outcome of the first roll is printed first, and the outcome of the second roll is printed second Please use the rollDie function given below to simulate the roll of a single die. . / rollDie returns a random integer between 1 and 6, works as rolling a die *return value, int number (1-6) int rollDie return random() % 6 + 1

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

Step: 3

blur-text-image

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

Development Of Knowledge Framework For Affective Content Analysis

Authors: Swarnangini Sinha

1st Edition

B0CQJ13WZ1, 979-8223977490

More Books

Students also viewed these Databases questions

Question

Explain strong and weak atoms with examples.

Answered: 1 week ago

Question

Explain the alkaline nature of aqueous solution of making soda.

Answered: 1 week ago

Question

Comment on the pH value of lattice solutions of salts.

Answered: 1 week ago