Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please use iostream cstdlib ctime to creat a program that will play rock paper scissors with you.thanks One Round of Rock, Paper, Seissors This week

image text in transcribedplease use iostream cstdlib ctime to creat a program that will play rock paper scissors with you.thanks
image text in transcribed
One Round of Rock, Paper, Seissors This week you will be working by yourself or with a partner to game with a computer opponent. Generating Random NumbeES We can generate a random number using two C++ libraries: #include //Random number generator (among other things) #include //we will use the current time as a seed When asked for a value, the random number generator will return a pseudo-random number between o and RAND MAX (defined in cstdlib) On value into a smaller set of values, we can use the modulo operator (8) Observe the following pattern: our random 12 % 3-0 14 % 3 2 we count up, the sequence of modulo results repeats from to the 3%3 0 483 1 5% 2 6%3-0 10 % 1 11 3-2 2%3=2 right hand operand of the modulo 1 One feature of the random number generator is that it will always give you the same sequence of values when called. It uses a seed value to determine what sequence of numbers it should create. Ideally, we would want to set our seed to a random value,but in order to do that we would need a random value. The next best thing is to use a value that is always changing, the current time. srand (time (0))/set the seed to the current time If not set, the random number generator will use 1 as its seed. To generator a value, we wil1 use the rand) function from . cout

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

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

ISBN: 0764549634, 9780764549632

More Books

Students also viewed these Databases questions