The game Dungeons and Dragons introduces an element of chance using a 20-sided die. Sides are marked 1 to 20. When the d

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

The game Dungeons and Dragons introduces an element of chance using a 20-sided die. Sides are marked 1 to 20. When the d

Post by answerhappygod »

The game Dungeons and Dragons introduces an element of chance
using a 20-sided die. Sides are marked 1 to 20. When the die is
thrown, the side it comes to rest on has the number that is
used.
a. Use rand( ) in a C++ expression that will have a random value
from 1 to 20.

b. Write a C++ function that returns a random number from 1 to
20.

c. When a program uses rand( ), a statement is used to make sure
that the program produces different random number each time it is
run. Write that statement.

d. Write the #include statements needed in a program that uses
rand( ) and the answer to 1.c.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply