Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program that asks the user to enter the seed for a random number generator. Then the program uses this seed to roll

Write a C++ program that asks the user to enter the seed for a random number generator. Then the program uses this seed to roll a dice and hence generates two integers corresponding to the faces of each dice. If their sum is odd, the user has two tries to guess the sum. The program gives the user a hint after the first try. Otherwise, the user has three tries to guess the sum.

Sample run 1:

Enter the seed of the random number generator: 15

The sum is odd, you have two tries to guess the sum.

Enter first guess: 7

Incorrect. Hint: Sum is larger than 7.

Try again: 9

Incorrect. The sum is 5+6 = 11

Sample run 2:

Enter the seed of the random number generator: 52

The sum is even, you have three tries to guess the sum.

Enter first guess: 6

Incorrect. Try again: 10

Incorrect. Try again: 8

Congratulations, sum of 5+3 is 8

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

Essential Data Protection For Estate Agencies In Singapore 2024

Authors: Yang Yen Thaw Yt

1st Edition

B0CQK79WD3, 979-8872095392

More Books

Students also viewed these Databases questions