This is a class that uses a vector to store 3 points (x,y,z) so i can find the distance from each of the points. Can anyone help me??

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define inline

using namespace std;

int main()
{
	class Vector3
	{
	public: float x, y, z;
			Vector3() {}
			Vector3(const Vector3 &a) : x(a.x), y(a.y), z(a.z) {}
			Vector3(float nx, float ny, float nz) : x(nx), y(ny), z(nz) {}
			Vector3 &operator = (const Vector3 &a)
			{
				x = a.x;
				y = a.y;
				z = a.z;
				return *this;
			}
			bool operator ==(const Vector3 &a) const 
			{
				return x==a.x && y ==a.y && z==a.z;
			}
			bool operator !=(const Vector3 &a) const
			{
				return x != a.x || y != a.y || z != a.z;
			}
			void zero()
			{
				x = y = z = 0.0f;
			}
			Vector3 operator -() const
			{
				return Vector3(-x, -y, -z);
			}
			Vector3 operator +( const Vector3 &a) const
			{
				return Vector3(x + a.x, y + a.y, z + a.z);
			}
			Vector3 operator -( const Vector3 &a) const
			{
				return Vector3(x - a.x, y - a.y, z - a.z);
			}
			Vector3 operator *(float a) const
			{
				return Vector3(x * a, y * a, z * a);
			}
			Vector3 operator /(float a) const
			{
				float oneOverA = 1.0f / a;
				return Vector3(x * oneOverA, y * oneOverA, z * oneOverA);
			}
			Vector3 &operator +=(const Vector3 &a)
			{
				x += a.x;
				y += a.y;
				z += a.z;
				return *this;
			}
			Vector3 &operator -=(const Vector3 &a)
			{
				x -= a.x;
				y -= a.y;
				z -= a.z;
				return *this;
			}
			Vector3 &operator *=(float a)
			{
				x *= a;
				y *= a;
				z *= a;
				return *this;
			}
			Vector3 &operator /=(float a)
			{
				float oneOverA = 1.0f / a;
				x *= oneOverA;
				y *= oneOverA;
				z *= oneOverA;
				return *this;
			}
			void normalize()
			{
				float magSq = x*x + y*y + z*z;
				if(magSq > 0.0f)
				{
					float oneOverMag = 1.0f / sqrt(magSq);
					x *= oneOverMag;
					y *= oneOverMag;
					z *= oneOverMag;

				}
				else if(magSq < 0.0f)
				{
					cout << "There has got to be an error." << endl;
					cout << endl;
					normalize();
				}
			}
			float operator *(const Vector3 &a) const 
			{
				return x * a.x + y * a.y + z * a.z;
			}
	};
	
	inline float vectorMag(const Vector3 &a)
	{
		return sqrt(a.x * a.x + a.y * a.y + a.z * a.z);
	}
	
	inline Vector3 crossProduct(const Vector3 &a, const Vector3 &b)
	{
		return Vector3( a.y * b.z - a.z * b.y, 
			            a.z * b.x - a.x * b.z, 
			            a.x * b.y - a.y * b.x);
	}
	
	inline Vector3 operator *(float k, const Vector3 &v)
	{
		return Vector3(k * v.x, k * v.y, k * v.z); 
	}

	inline float distance( const Vector3 &a, const Vector3 &b)
	{
		float dx = a.x - b.x;
		float dy = a.y - b.y;
		float dz = a.z - b.z;
		return sqrt(dx * dx + dy * dy + dz * dz);
	}

	cout << endl;
	system("pause");
	return 0;
}

Recommended Answers

All 12 Replies

Yes, someone can help you.

The teacher teaching me now is a college algebra teacher. She knows programming, but she is rusty.

What Narue is saying is that you need to elaborate on what your problem is. There are extremely few people here that can magically divine such information.

You can get help here, but you need to tell us what your understanding of the issue is before we can even begin to.

Oh! Ok. =) My bad. =)

This is a class vector for 6 points (x, y, z).
Our teacher is teaching this to our class, but she isn't really all tat familiar with some of these things. Anyway,

Vector3 &operator = (const Vector3 &a)
{
x = a.x;
y = a.y;
z = a.z;
return *this;
}

this is saying that the first 3 inputs are going to be x, y, z and to return them.

bool operator ==(const Vector3 &a) const
{
return x==a.x && y ==a.y && z==a.z;
}

this is a booleant that says x can only be a.x input and y can only be a.y input and z can only be a.z input.

void zero()
{
x = y = z = 0.0f;
}
Vector3 operator -() const
{
return Vector3(-x, -y, -z);
}

this means that the program can use the value 0 and the user can allow negative numbers and outcomes of calculating.

Vector3 operator +( const Vector3 &a) const
{
return Vector3(x + a.x, y + a.y, z + a.z);
}
Vector3 operator -( const Vector3 &a) const
{
return Vector3(x - a.x, y - a.y, z - a.z);
}
Vector3 operator *(float a) const
{
return Vector3(x * a, y * a, z * a);
}
Vector3 operator /(float a) const
{
float oneOverA = 1.0f / a;
return Vector3(x * oneOverA, y * oneOverA, z * oneOverA);
}

the calculations

void normalize()
{
float magSq = x*x + y*y + z*z;
if(magSq > 0.0f)
{
float oneOverMag = 1.0f / sqrt(magSq);
x *= oneOverMag;
y *= oneOverMag;
z *= oneOverMag;
 
}
else if(magSq < 0.0f)
{
cout << "There has got to be an error." << endl;
cout << endl;
normalize();
}
}
float operator *(const Vector3 &a) const
{
return x * a.x + y * a.y + z * a.z;
}
};

Finding the magnitude...(no clue why I need that)

i need just inline help

You still haven't asked any questions.

ok why do i need magnitude and can someone fix my code so it can run successfully so I can see what I did wrong??

>>ok why do i need magnitude and can someone fix my code so it can run successfully so I can see what I did wrong??

Better, but now you're asking us to do your homework. We won't do that.

Are you getting compile errors? If so, what are they?

If the code compiles, which I'm fairly sure it doesn't, are you getting incorrect results (if any)?

You need to elaborate on these types of things. Without that information, we can do nothing for you.

error C2601: 'vectorMag' : local function definitions are illegal
1> c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(12): this line contains a '{' which has not yet been matched
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(117): error C2146: syntax error : missing ';' before identifier 'crossProduct'
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(117): error C2182: 'Vector3' : illegal use of type 'void'
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(117): error C2143: syntax error : missing ')' before 'const'
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(117): error C2059: syntax error : ')'
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(118): error C2143: syntax error : missing ';' before '{'
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(119): error C2065: 'a' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(119): error C2228: left of '.y' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(119): error C2065: 'b' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(119): error C2228: left of '.z' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(119): error C2065: 'a' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(119): error C2228: left of '.z' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(119): error C2065: 'b' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(119): error C2228: left of '.y' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(120): error C2065: 'a' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(120): error C2228: left of '.z' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(120): error C2065: 'b' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(120): error C2228: left of '.x' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(120): error C2065: 'a' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(120): error C2228: left of '.x' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(120): error C2065: 'b' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(120): error C2228: left of '.z' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(121): error C2065: 'a' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(121): error C2228: left of '.x' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(121): error C2065: 'b' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(121): error C2228: left of '.y' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(121): error C2065: 'a' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(121): error C2228: left of '.y' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(121): error C2065: 'b' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(121): error C2228: left of '.x' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(121): error C2064: term does not evaluate to a function taking 3 arguments
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(117): error C3861: 'crossProduct': identifier not found
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(124): error C2143: syntax error : missing ';' before '*'
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(124): error C2182: 'Vector3' : illegal use of type 'void'
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(124): error C2086: 'int Vector3' : redefinition
1> c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(117) : see declaration of 'Vector3'
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(124): error C2144: syntax error : 'float' should be preceded by ')'
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(124): error C2059: syntax error : ')'
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(125): error C2143: syntax error : missing ';' before '{'
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(126): error C2065: 'k' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(126): error C2065: 'v' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(126): error C2228: left of '.x' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(126): error C2065: 'k' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(126): error C2065: 'v' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(126): error C2228: left of '.y' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(126): error C2065: 'k' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(126): error C2065: 'v' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(126): error C2228: left of '.z' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(126): error C2064: term does not evaluate to a function taking 3 arguments
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(124): error C3861: '*': identifier not found
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(129): error C2120: 'void' illegal with all types
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(129): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(129): error C2143: syntax error : missing ',' before '&'
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(130): error C2601: 'distance' : local function definitions are illegal
1> c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(12): this line contains a '{' which has not yet been matched
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(131): error C2065: 'a' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(131): error C2228: left of '.x' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(131): error C2065: 'b' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(131): error C2228: left of '.x' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(132): error C2065: 'a' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(132): error C2228: left of '.y' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(132): error C2065: 'b' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(132): error C2228: left of '.y' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(133): error C2065: 'a' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(133): error C2228: left of '.z' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(133): error C2065: 'b' : undeclared identifier
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(133): error C2228: left of '.z' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(134): error C2562: 'distance' : 'void' function returning a value
1> c:\users\zvjezdan\documents\visual studio 2010\projects\week5_math\week5_math\program.cpp(129) : see declaration of 'distance'
1>
1>Build FAILED.
1>

It all begins when I use inline

The general form of your program should be something like this:

//#include statements

//constant definitions

//class/function declarations

//main function

//function implementations

The specific organization is highly subjective based on the programmer and corporate standards, but in general for it to be functional it will have a similar structure.

This is what you seem to have:

//#include statements

//constant definitions

//main function {

  //class/function declarations

  //function implementations

}

See a problem here?

I now have 2 errors. operator *() on line 123 is the problem.

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstdlib>
#define inline

using namespace std;

int main()
{
	class Vector3
	{
	public: float x, y, z;
			Vector3() {}
			Vector3(const Vector3 &a) : x(a.x), y(a.y), z(a.z) {}
			Vector3(float nx, float ny, float nz) : x(nx), y(ny), z(nz) {}
			Vector3 &operator = (const Vector3 &a)
			{
				x = a.x;
				y = a.y;
				z = a.z;
				return *this;
			}
			bool operator ==(const Vector3 &a) const 
			{
				return x==a.x && y ==a.y && z==a.z;
			}
			bool operator !=(const Vector3 &a) const
			{
				return x != a.x || y != a.y || z != a.z;
			}
			void zero()
			{
				x = y = z = 0.0f;
			}
			Vector3 operator -() const
			{
				return Vector3(-x, -y, -z);
			}
			Vector3 operator +( const Vector3 &a) const
			{
				return Vector3(x + a.x, y + a.y, z + a.z);
			}
			Vector3 operator -( const Vector3 &a) const
			{
				return Vector3(x - a.x, y - a.y, z - a.z);
			}
			Vector3 operator *(float a) const
			{
				return Vector3(x * a, y * a, z * a);
			}
			Vector3 operator /(float a) const
			{
				float oneOverA = 1.0f / a;
				return Vector3(x * oneOverA, y * oneOverA, z * oneOverA);
			}
			Vector3 &operator +=(const Vector3 &a)
			{
				x += a.x;
				y += a.y;
				z += a.z;
				return *this;
			}
			Vector3 &operator -=(const Vector3 &a)
			{
				x -= a.x;
				y -= a.y;
				z -= a.z;
				return *this;
			}
			Vector3 &operator *=(float a)
			{
				x *= a;
				y *= a;
				z *= a;
				return *this;
			}
			Vector3 &operator /=(float a)
			{
				float oneOverA = 1.0f / a;
				x *= oneOverA;
				y *= oneOverA;
				z *= oneOverA;
				return *this;
			}
			void normalize()
			{
				float magSq = x*x + y*y + z*z;
				if(magSq > 0.0f)
				{
					float oneOverMag = 1.0f / sqrt(magSq);
					x *= oneOverMag;
					y *= oneOverMag;
					z *= oneOverMag;

				}
				else if(magSq < 0.0f)
				{
					cout << "There has got to be an error." << endl;
					cout << endl;
					normalize();
				}
			}
			float operator *(const Vector3 &a) const 
			{
				return x * a.x + y * a.y + z * a.z;
			}
	
	inline float vectorMag(const Vector3 &a)
	{
		return sqrt(a.x * a.x + a.y * a.y + a.z * a.z);
	}
	
	inline Vector3 crossProduct(const Vector3 &a, const Vector3 &b)
	{
		return Vector3( a.y * b.z - a.z * b.y, 
			            a.z * b.x - a.x * b.z, 
			            a.x * b.y - a.y * b.x);
	}
	
	inline Vector3 operator *(float k, const Vector3 &v)
	{
		return Vector3(k * v.x, k * v.y, k * v.z); 
	}

	inline float distance( const Vector3 &a, const Vector3 &b)
	{
		float dx = a.x - b.x;
		float dy = a.y - b.y;
		float dz = a.z - b.z;
		return sqrt(dx * dx + dy * dy + dz * dz);
	}
	};

	cout << endl;
	system("pause");
	return 0;
}

I have 2 errors. they are both produced on line 123. Vector operator *(float k, const Vector3 &v)

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstdlib>
#define inline

using namespace std;

int main()
{
	class Vector3
	{
	public: float x, y, z;
			Vector3() {}
			Vector3(const Vector3 &a) : x(a.x), y(a.y), z(a.z) {}
			Vector3(float nx, float ny, float nz) : x(nx), y(ny), z(nz) {}
			Vector3 &operator = (const Vector3 &a)
			{
				x = a.x;
				y = a.y;
				z = a.z;
				return *this;
			}
			bool operator ==(const Vector3 &a) const 
			{
				return x==a.x && y ==a.y && z==a.z;
			}
			bool operator !=(const Vector3 &a) const
			{
				return x != a.x || y != a.y || z != a.z;
			}
			void zero()
			{
				x = y = z = 0.0f;
			}
			Vector3 operator -() const
			{
				return Vector3(-x, -y, -z);
			}
			Vector3 operator +( const Vector3 &a) const
			{
				return Vector3(x + a.x, y + a.y, z + a.z);
			}
			Vector3 operator -( const Vector3 &a) const
			{
				return Vector3(x - a.x, y - a.y, z - a.z);
			}
			Vector3 operator *(float a) const
			{
				return Vector3(x * a, y * a, z * a);
			}
			Vector3 operator /(float a) const
			{
				float oneOverA = 1.0f / a;
				return Vector3(x * oneOverA, y * oneOverA, z * oneOverA);
			}
			Vector3 &operator +=(const Vector3 &a)
			{
				x += a.x;
				y += a.y;
				z += a.z;
				return *this;
			}
			Vector3 &operator -=(const Vector3 &a)
			{
				x -= a.x;
				y -= a.y;
				z -= a.z;
				return *this;
			}
			Vector3 &operator *=(float a)
			{
				x *= a;
				y *= a;
				z *= a;
				return *this;
			}
			Vector3 &operator /=(float a)
			{
				float oneOverA = 1.0f / a;
				x *= oneOverA;
				y *= oneOverA;
				z *= oneOverA;
				return *this;
			}
			void normalize()
			{
				float magSq = x*x + y*y + z*z;
				if(magSq > 0.0f)
				{
					float oneOverMag = 1.0f / sqrt(magSq);
					x *= oneOverMag;
					y *= oneOverMag;
					z *= oneOverMag;

				}
				else if(magSq < 0.0f)
				{
					cout << "There has got to be an error." << endl;
					cout << endl;
					normalize();
				}
			}
			float operator *(const Vector3 &a) const 
			{
				return x * a.x + y * a.y + z * a.z;
			}
	
	inline float vectorMag(const Vector3 &a)
	{
		return sqrt(a.x * a.x + a.y * a.y + a.z * a.z);
	}
	
	inline Vector3 crossProduct(const Vector3 &a, const Vector3 &b)
	{
		return Vector3( a.y * b.z - a.z * b.y, 
			            a.z * b.x - a.x * b.z, 
			            a.x * b.y - a.y * b.x);
	}
	
	inline Vector3 operator *(float k, const Vector3 &v)
	{
		return Vector3(k * v.x, k * v.y, k * v.z); 
	}

	inline float distance( const Vector3 &a, const Vector3 &b)
	{
		float dx = a.x - b.x;
		float dy = a.y - b.y;
		float dz = a.z - b.z;
		return sqrt(dx * dx + dy * dy + dz * dz);
	}
	};

	cout << endl;
	system("pause");
	return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.