Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool Vector3D::operator< (const Vector3D& other) const
- {
- for(int k = 0; k < NUM_COORDINATES; ++k)
- if(coordinates[k] < other.coordinates[k]) return true;
- return false;
- }
- Vector3D.h
- class Vector3D
- {
- public:
- Vector3D();
- void set(int arrayIndex,int num);
- bool operator< (const Vector3D& other) const;
- private:
- static const int NUM_COORDINATES = 3;
- double coordinates[NUM_COORDINATES];
- };
- Vector3D.cpp
- #include "Vector3D.h"
- Vector3D::Vector3D(void){
- }
- void Vector3D::set(int arrayIndex,int num){
- coordinates[arrayIndex]=num;
- }
- bool Vector3D::operator< (const Vector3D& other) const
- {
- for(int k = 0; k < NUM_COORDINATES; ++k)
- if(coordinates[k] < other.coordinates[k]) return true;
- return false;
- }
Add Comment
Please, Sign In to add comment