+ 1

How can I save the coordinates of the two points a and b in 3D space as follows(using class)

Value a as constructor and coordinates (5,10,2) and value b as setpoint function with coordinates (6,20,5) I wrote it before: #include <iostream> using namespace std; class point3D { public: int X,Y,Z; point3D(const int a, const int b, const int c); int x() const; int y() const; int z() const; void setpoint(int,int,int); }; point3D::point3D() { X=0; Y=0; Z=0; } point3D::point3D(const int a, const int b, const int c) { X=a; Y=b; Z=c; } int main() { point3D p1(5,10,2); point3D p2; p2.setpoint(6,20,5); return 0; }

11th Jan 2022, 7:04 PM
Nadia
Nadia - avatar
3 Respuestas
+ 1
First of all thank you so much for correcting my code🙏🏻🙏🏻 it's really help me And about your question it's a code practice problem that have 4 parts and I get confused because I don't know what to do 🤦🏻‍♀️ For example in a part of that it said that if you put "cout<< point3D::count<<endl;" in the last statement of int main what will be the output? And for access to this static element what do you suggest? And I don't know what I should do because I don't have any output):
12th Jan 2022, 9:27 AM
Nadia
Nadia - avatar