- Joined
- Apr 28, 2002
- Location
- North Dakota
I am just learning how to program and i am having a very hard time learning how to us classes in c++.
I have writen a program but it refuses to work.
//---------------------------------------------------------------------------
#include <vcl.h>
#include <iostream.h>
class Point
{
private:
double x;
double y;
public:
double getX();
double getY();
Point(double xx, double yy);
};
int main()
{
int i;
int stop;
double x1;
double y1;
//trying to create 5 object variable of Point with arrary
Point P[5];
for (i=0;i<5;i++)
{
cin>>x1;
cin>>y2;
Point P=Point(x1,y1);
cout<<"For the point "<<i+1<<endl;
cout<<P.getX()<<" "<< P.getY()<<endl;
}
cin>>stop;
}
double Point::getX()
{
return x;
}
double Point::getY()
{
return y;
}
Point:oint(double xx, double yy)
{
x=xx;
y=yy;
}
Thank you for any help!!!!!!!
I have writen a program but it refuses to work.
//---------------------------------------------------------------------------
#include <vcl.h>
#include <iostream.h>
class Point
{
private:
double x;
double y;
public:
double getX();
double getY();
Point(double xx, double yy);
};
int main()
{
int i;
int stop;
double x1;
double y1;
//trying to create 5 object variable of Point with arrary
Point P[5];
for (i=0;i<5;i++)
{
cin>>x1;
cin>>y2;
Point P=Point(x1,y1);
cout<<"For the point "<<i+1<<endl;
cout<<P.getX()<<" "<< P.getY()<<endl;
}
cin>>stop;
}
double Point::getX()
{
return x;
}
double Point::getY()
{
return y;
}
Point:oint(double xx, double yy)
{
x=xx;
y=yy;
}
Thank you for any help!!!!!!!