ok so i am new to programing and need to make a program that adds and subtracts two coordinates
this is the main file
#include <iostream>
#include "Coordinate.h"
using namespace std;
int main()
{
Coordinate a( 1, 7, 0 ), b( 9, 8, 7 ), c;
a.printCoordinate();
cout << " + ";
b.printCoordinate();
cout << " = ";
c = a.add( b );
c.printCoordinate();
cout << '\n';
a.setCoordinate( 10, 1, 10 );
b.setCoordinate( 11, 3, 20 );
a.printCoordinate();
cout << " - ";
b.printCoordinate();
cout << " = ";
c = a.subtract( b );
c.printCoordinate();
cout << endl;
}
and this is what i have so far for the header file
#include<iostream>
using namespace std;
class Coordinate
{
private:
Coordinate double a(int = 0, int = 0, int = 0); //to assign value to
Coordinate double b(int = 0, int = 0, int = 0); //coordinates
public:
int add()
{
return a.x+b.x+c.x, a.y+b.y+c.y, a.z+b.z+c.z;
}
int subtract()
{
return a.x-b.x-c.x, a.y-b.y-c.y, a.z-b.z-c.z;
}
void printCoordinate
{
cout<< a;
cout<< b;
cout<< c;
}
int setCoordinate
{
}
};
can anyone let me know if i am doing this program completely wrong, if i'm on the right track or anything. Thanks for any help