Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Recommended Textbook for

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

Students also viewed these Databases questions

Question

=+C&B (especially taxation) laws, regulations, and practices?

Answered: 1 week ago

Question

=+designing international assignment C&B packages.

Answered: 1 week ago