Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Edit the given program to produce the following output: - Take in the name of a superhero & tell him how many villains he/she has

Edit the given program to produce the following output: - Take in the name of a superhero & tell him how many villains he/she has to defeat today - The number of villains is randomly generated and should be a number between 11 and 42. - Use a seed of 7. Hint: Compile the program first before making edits

What is your name? Hello Captain America There are 42 villains you need to defeat today Oops! one of the villains was able to multiply himself by a power of 3. There are actually 74088 villains. 

#include //make sure that all necessary libraries are included & correct using namespace std;

int main() { string name; int number; cout << "What is your name?" << endl; cin >> name; cout << "Hello " << name << endl; cout << "There are "<< number >> " villains you need to defeat today"<< endl; // edit and include any necessary code cout << "Oops! one of the villains was able to multiply himself by a power of 3. There are actually villains." << endl;

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

Define the term Working Capital Gap.

Answered: 1 week ago