Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Description (It has to work with c++ thank you) The purpose of this challenge is examine the output and write the C++ source code that

Description (It has to work with c++ thank you)

The purpose of this challenge is examine the output and write the C++ source code that produces the given output and interaction.

Requirements

  1. You may use any combination of variable declarations, assignments, conditional statements, expressions, loops, etc
  2. Include and to enable the use of the built-in random number generator. See below on how to use the random number generator to have the computer produce integers within a given range.
 #include  #include  #include  int main() { int v1, v2, v3; srand(time(NULL)); // these are examples on how to use the rand() function // v1, v2 and v3 are assigned random numbers below in the // ranges shown in the comments v1 = rand() % 100; // v1 in the range 0 to 99 v2 = rand() % 100 + 1; // v2 in the range 1 to 100 v3 = rand() % 30 + 1985; // v3 in the range 1985-2014 return 0; } 

Sample Interaction / Output

 $ [ run your program ] You have $20.00 in your account What is your wager? 5.00 Rock, Paper, Scissors (r/p/s): r You showed rock, I showed scissors - You win! You won $5.00, let your wager ride (y/n)? y Ok, your wager is now 10.00 Rock, Paper, Scissors (r/p/s): s You showed scissors, I showed paper - You win! You won $10.00, let your wager ride (y/n)? n You have $30.00 in your account What is your wager? 20.00 Rock, Paper, Scissors (r/p/s): p You showed paper, I showed rock - You lose! You have $10.00 in your account What is your wager? 10.00 Rock, Paper, Scissors (r/p/s): p You showed paper, I showed scissors - You lose! You have $0.00 in your account GAME OVER $ [ back to the command prompt ] 

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions