Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For the following examples, explain what is wrong and how to correct it If nothi

ID: 3537131 • Letter: F

Question

For the following examples, explain what is wrong and how to correct it
If nothing is wrong, explain what is involved and how it works,
show output

Every time you are prompted to enter a number,
with each EXAMPLE, enter 1, 2, 3, etc.
and keep entering the next integer for as many times you are prompted.

Use the same class Box each time.
Who can draw the diagrams of how the objects and pointers are set up
in each Example? I am sorry, but only if you can draw the data structures in each case, that you understand what is going on.
If you find the drawings of the data structures confusing,
then in my opinion, you don't fully understand the code. sorry :-(

Please answer only one example and discuss these in order

EXAMPLE A
#include <iostream>
#include <stdio.h>
using namespace std;
class Box
{
private: int size;
public: Box( ) { cout << "Enter size ";
cin >> size; }
void show( ) { cout << "size is " << size << endl; }
};
int main()
{
cout << "Hello" << endl;
Box b;
b.show();
}


Explanation / Answer

the output:


Hello (comes from the first cout<< statement in main)
Enter size 1 (this is from the constructor)

size is 1 (this is from show method)