Edit the given program to produce the following output in c++ mode: - Take in the name...

90.2K

Verified Solution

Question

Electrical Engineering

Edit the givenprogram to produce the following output in c++ mode:
- Take in the name of a superhero & tell him how many villainshe/she has to defeat today - The number of villains is randomlygenerated 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 AmericaThere are 42 villains you need to defeat todayOops! one of the villains was able to multiply himself by a power of 3.There are actually 74088 villains.

the program starts her

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

int main() {
string name;
int number;

  
   cout << \"What is your name?\" <   cin >> name;
   cout << \"Hello \" << name <   cout << \"There are \"<< number >> \"villains you need to defeat today\"<   cout << \"Oops! one of the villains was able tomultiply himself by a power of 3. There are actually villains.\"<< endl;
  
  
  

   return 0;
}

Answer & Explanation Solved by verified expert
4.3 Ratings (734 Votes)
The code is well commented and given below Also the screenshotof the output and code itself is provided for better readabilityPlease go    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students