ok guys need some help, I'm sure the answer is simple but i'm making a program for an assignement that models points in a cartesian plane and prints them out this is what i have so far
in main
#include "point.h"
#include <iostream>
#include <string>
#include <fstream> //for ifstream,ofstream
#include <iomanip>
#include <stdio.h> // Need for getchar
using namespace std;
int main()
{
double a, b;
double x1,y1;
point(); // default contructor
point ( a, b); // contructor
//points( const points &init):// copy constructor
//~point();
x1 = getX() const;
y1 = getY() const;
cout.setf (ios::showpoint );
cout.setf( ios::fixed);
cout << setprecision(2);
char ch = getchar();
return 0;
}
.H file
#ifndef POINTS_H
#define POINTS_H
#include <iostream>
#include <fstream>
using namespace std;
class point
{
private:
double xval;
double yval;
public:
double getX() const;
double getY() const;
point(); // default contructor
point ( double x, double y); // contructor
//point( const point& temp);// copy constructor
~point(); // destructor
void setX(double x);
void setY(double y);
void setPoints( double x, double y);
friend ostream &operator<<(ostream& outs, const point& P);
friend istream &operator>>(istream& ins, point &P);
void tostring();
};
.cpp file
#include "point.h" //obtain prototype definitions
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
point::point()
{
double x = 0;
double y = 0;
cout << " calling default contructor" << endl;
}
////////////////////////////////////////////////////////////////////////////////////////////////
point::point ( double x, double y)
{
xval=x;
yval=y;
cout << "calling contructor" << endl;
}
////////////////////////////////////////////////////////////////////////////////////////////////
point::~point()
{
cout << "Calling Destructor" << endl;
}
////////////////////////////////////////////////////////////////////////////////////////////////
double point::getX()
{
double x;
cout << " Enter point x: " << endl;
cin >> x;
return x;
}
////////////////////////////////////////////////////////////////////////////////////////////////
double point::getY()
{
double y;
cout << " Enter point y: " << endl;
cin >> y;
return y;
}
////////////////////////////////////////////////////////////////////////////////////////////////
void point::setPoints( double x, double y)
{
setX(x);
setY(y);
}
void point::setX(double x)
{
xval=x;
}
////////////////////////////////////////////////////////////////////////////////////////////////
void point::setY(double y)
{
yval=y;
}
////////////////////////////////////////////////////////////////////////////////////////////////
any words of wisdom would be great