Answered step by step
Verified Expert Solution
Question
1 Approved Answer
There are bugs in these 3 programs, find the errors in each and tell me how you fixed them. Send a fixed program of each
There are bugs in these 3 programs, find the errors in each and tell me how you fixed them.
Send a fixed program of each in the end. Thanks:)
1st code:
#includeint main() { cout < "!!!Hello World!!!" < endl; // prints !!!Hello World!!! return 0; }
2nd code:
#includeusing namespace std; int main() { string age; cout << "Please enter your name: "; cin >> userName; cout << "Hello " << userName << ", how are you?" << endl; cout << "Please enter your age: "; cin >> age; cout << "Here is your age doubled: " << age*2 << endl; return 0; }
3rd code:
#includeusing namespace std; int main() { int largeInteger = 34389340934938; int result; int choice; string resultString = ""; cout << "The value of largeInteger is: " << largeInteger << endl; cout << "Please choose from one of the following options and enter your choice (1, 2, or 3). "; cout << "1: divide largeInteger by 2. "; cout << "2: divide largeInteger by 3. "; cout << "3: mod the largeInteger by 9. "; cout << "Enter choice: "; cin >> choice; switch(choice){ case 1: result = largeInteger/2; resultString = "Your result after dividing by 2: "; case 2: result = largeInteger/3; resultString = "Your result after dividing by 3: "; case 3: result = largeInteger%9; resultString = "Your result after moding by 9: "; } cout << resultString << result << endl; 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