Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!