Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please provide the updated code to copy and paste C++ / PreLab 3 Assignment //copy and paste into the IDE // The following is a

Please provide the updated code to copy and paste

C++

/ PreLab 3 Assignment //copy and paste into the IDE

// The following is a simple dice roller for a table top game. // The code to randomly generate a number is provided. // Don't worry about fully understanding the provided code // as you will not be tested over it.

// Finish the program by adding requested code marked "ADD HERE"

#include #include // for seeding rand #include // C standard library

using namespace std;

int main() {

int random_number;

// seeds rand (needed for getting random numbers) srand(time(NULL));

// randomly generates a number 1 - 20 inclusively random_number = rand() % 20 + 1;

cout << "You roll a " << random_number << ": ";

// ADD HERE - write an IF statement that prints "CRITICAL HIT!!" // if the user rolls a 20

// ADD HERE - write an ELSE IF statement that prints "Attack Strikes" // if the user rolls between 12 and 19 inclusive.

// ADD HERE - write an ELSE statement that prints "Attack Misses" // for any other roll

return 0; }

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

Students also viewed these Databases questions

Question

List the different categories of international employees. page 642

Answered: 1 week ago

Question

Explain the legal environments impact on labor relations. page 590

Answered: 1 week ago