Question: C++ Will Upvote Correct Solution! A) Fix any errors to get the following program to run in your environment. B) Document each line of code

C++

Will Upvote Correct Solution!

A) Fix any errors to get the following program to run in your environment. B) Document each line of code with comments and descibe any changes you had to make to the original code to get it to work. C) Write a summary of what your final version of the program does. Include a copy of the output after your summary.

#include using namespace std; int main() { int num1 = 1, num2 = 2, num3 = 3; const int* p1 = &num1; int* const p2 = &num2; const int* const p3 = &num3; num1 = 11; num2 = 22; num3 = 33; cout << num1 << " " << num2 << " " << num3 << endl; cout << p1 << " " << p2 << " " << p3 << endl; cout << *p1 << " " << *p2 << " " << *p3 << endl; *p1 = *p2; *p2 = *p3; *p3 = *p1; cout << num1 << " " << num2 << " " << num3 << endl; cout << p1 << " " << p2 << " " << p3 << endl; cout << *p1 << " " << *p2 << " " << *p3 << endl; *p2 = 22; p1 = p2; p2 = p3;

p3 = p1; cout << num1 << " " << num2 << " " << num3 << endl; cout << p1 << " " << p2 << " " << p3 << endl; cout << *p1 << " " << *p2 << " " << *p3 << endl; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!