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

What is printed by the following piece of code? #include<iostream> using namespa

ID: 3807333 • Letter: W

Question

What is printed by the following piece of code?

#include<iostream>

using namespace std;

class secretType

{

public:

    void setXandY(int,int);

    void print() const;

    void incrementY();

private:

    int x;

    int y;

};

int main()

{

     secretType mine,yours;

     mine.setXandY(3,2);

     yours.setXandY(4,5);

     mine.print();

     yours.print();

     mine.incrementY();

     mine.print();

     yours.print();

}

void secretType::setXandY(int a, int b)

{

    x = a;

     y = b;

}

void secretType::print() const

{

    cout << "x = " << x << ", y = " << y << endl;

}

void secretType::incrementY()

{

     y++;}

Explanation / Answer

OUTPUT for the above program:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote