#include<iostream>
#include<cstdlib>
usingnamespace std;
class point {
private:
int x, y;
public:
point(int x1, int y1);
int getX();
int getY();
void print();
point (const point & pt)
{ x = pt.x; y = pt.y; }
};
point::point(int x1, int y1) {
x = x1;
y = y1;
}
int point::getX() {
return x;
}
int point::getY() {
return y; }
void point::print() {
cout << "(" << x << ", " << y << ") " << endl;
}
int main(){
point a(3, 2);
point b(1,1);
a.getX();
cout<<a.getX()<<endl;
b.print();
point d(a);
cout<<"copy: "<<d<<endl;
return 0;
}
How about you add the prototype for the setX function between lines 12 and 13, for starters? It will have a return type of void and will take one parameter of type int.