Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

C++
image text in transcribed
Exercise 1 Write a 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

Intelligent Information And Database Systems Third International Conference Achids 2011 Daegu Korea April 2011 Proceedings Part 2 Lnai 6592

Authors: Ngoc Thanh Nguyen ,Chong-Gun Kim ,Adam Janiak

2011th Edition

3642200419, 978-3642200410

More Books

Students also viewed these Databases questions

Question

Define Administration and Management

Answered: 1 week ago

Question

Define organisational structure

Answered: 1 week ago

Question

Define line and staff authority

Answered: 1 week ago

Question

a valuing of personal and psychological privacy;

Answered: 1 week ago