n1 ed out of question #include using namespace std; class vec { int x, y; public: vec() { x = 2; y = 2; } voi
Posted: Sat May 14, 2022 7:10 pm
n1 ed out of question #include <iostream> using namespace std; class vec { int x, y; public: vec() { x = 2; y = 2; } void setxY(int a, int b) { x = a; y = b; } void disp() { cout<< x << ',' << y <<endl; } }; E int main() { vec v1; v1.disp(); vec V2 v1; v1.setXY(2, 2); V2.disp(); 0 à 11 1,1 ob. 0 0 2,2 O c. 0,0 0.0 d. 1 1 22 o e. 2,2 2 2
2 ad out of question #include <iostream> using namespace std; class vec { int **, *y; public: vec() { x = new int; y = new int; *x = 5; *y = 5); } void setxY(int a, int b) { *x = a; *y = b; } void disp() { cout<< *x << ',' « *y <<endl; } }; int main() { Vec v1; v1.disp(); vec V2 = V1; v1.setXY(2, 2); v2.disp(); } O a 2.2 2,2 O b. 5. 5 2,2 O c.5.5 5,5 d. 2.2. 5.5
2 ad out of question #include <iostream> using namespace std; class vec { int **, *y; public: vec() { x = new int; y = new int; *x = 5; *y = 5); } void setxY(int a, int b) { *x = a; *y = b; } void disp() { cout<< *x << ',' « *y <<endl; } }; int main() { Vec v1; v1.disp(); vec V2 = V1; v1.setXY(2, 2); v2.disp(); } O a 2.2 2,2 O b. 5. 5 2,2 O c.5.5 5,5 d. 2.2. 5.5