#include<iostream>
using namespace std;
class Point{
	float x,y,z;
public:
	Point(float f_x=1.0, float f_y=1.0, float f_z=1.0);

	void setXYZ(float X, float Y, float Z);

	void setX(float X);
	void setY(float Y);
	void setZ(float Z);
	void getXYZ(float &X, float &Y, float &Z);
	
	float getX();
	float getY();
	float getZ();

};
Point::Point(float f_x, float f_y, float f_z)
{
	x= f_x;
	y= f_y;
	z= f_z;
}
float Point::getX()
{
	return x;
}
float Point::getY()
{
	return y;
}
float Point::getZ()
{
	return z;
}


void Point::setXYZ(float X, float Y, float Z)
{

	setX(X);
	setY(Y);
	setZ(z);
	/*
	x=X;
	y=Y;
	z=Z;
	*/
}

void Point::getXYZ(float &X, float &Y, float &Z)
{
	x=getX();
	y=getY();
	z=getZ();
}
void Point::setX(float X)
{
	x = X;
}

void Point::setY(float Y)
{
	y = Y;
}
void Point::setZ(float Z)
{
	z = Z;
}


int main()
{
	float x,y,z;
	Point mylocation(8,3,4);
	

	mylocation.getXYZ(x,y,z);
	cout<<x<< " " << y << " " << z <<endl;
	return 0;
	
}

Output should be
8 3 4

But displays result like
-1.07374e+008 -1.07374e+008 -1.07374e+008
WHY IS SO???? Help

Because your Point::getXYZ does nothing (see x target instead of X, y instead of Y ... ;) ).

Hi
Ark has 100% right.

have a look

#include<iostream>
using namespace std;

class Point
{	
public:
	Point() : m_x(0) ,m_y (1.0),m_z(1.0) {}
	Point(float x, float y, float z) : m_x(x) ,m_y (y),m_z(z) {}
	void setX(float someX) {m_x = someX;};
	void setY(float someY) {m_y = someY;};
	void setZ(float someZ) {m_z = someZ;};

	float getX() const {return m_x;};
	float getY() const {return m_y;};
	float getZ() const {return m_z;};

	void setXYZ(float someX, float someY, float someZ);
	void getXYZ(float& someX, float& someY, float& someZ);
	
private:
	float m_x,m_y,m_z;
};

void Point::setXYZ(float someX, float someY, float someZ)
{
	setX(someX);
	setY(someY);
	setZ(someZ);
}

void Point::getXYZ(float& someX, float& someY, float& someZ)
{
	someX=getX();
	someY=getY();
	someZ=getZ();
}

int main()
{
	float x,y,z;
	Point mylocation(8.0,3.0,4.0);
	mylocation.getXYZ(x,y,z);
	cout<<x<< " " << y << " " << z <<endl;
	return 0;	
}
This article has been dead for over six months. Start a new discussion instead.