Question
in c++ please follow instructions and fix the errors and please make a comment next to each code error you fix. Below are 25 code
in c++ please follow instructions and fix the errors and please make a comment next to each code error you fix.
- Below are 25 code fragments, inserted into a try catch block.
- Each line has zero or more errors. Your task is to find and remove all errors in each fragment.
- Do not fix problems by simply deleting a statement; repair the problems by changing, adding, or deleting a few characters.
- There may be different ways to fix them
- You may need to rename variables to avoid re-declaration errors
- When you fix a line, it should print out "Success!" and then a newline.
- You may want to comment out each line that you have not fixed yet in order to get it to compile, so you can test as you go
- In the end you should see a total of 25 "Success!" outputs
#include "std_lib_facilities.h" int main() try { //1. Cout << "Success! "; //2. cout << "Success! ; //3. cout << "Success" << ! " //4. cout << success << ' '; //5. string res = 7; vector keep_window_open(); return 0; } catch (exception& e) { cerr << "error: " << e.what() << ' '; keep_window_open(); return 1; } catch (...) { cerr << "Oops: unknown exception! "; keep_window_open(); return 2; } v(5); for (int i=0; 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