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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started