Hi, I'm new to the C++ programing and have try to write a small program for testing but is not working and with some error. Anyone here can help??
#include <iostream.h>
#include <iomanip.h>
class Point
{
double x,y;
public:
double get_x(return x);
double get_y(return y);
};
//------------------------------------------------
Point:oint (double x1, double y1)
{
x=x1;
y=y1;
}
void Point::changepos (doubble chaposx, double chaposy)
{
x+=chaposx;
y+=chaposy;
}
//-------------------------------------------------
void changepoint (Point)
{
if (T.get_x() < 0) || (T.get_y() < 0)
{ T.chapos (2,5);
cout << "\nPoint x value is "<<T.get_x();
cout << "\nPoint y value is "<<T.get_y();
}
else
cout << "\nNo change of x and y";
}
//-------------------------------------------------
main ()
{
Point sample (6,-4);
cout << "\nvalue of x : "<<sample.get_x();
cout << "\nvalue of y : "<<sample.get_y();
changepoint (sample) ;
cout << "\nvalue of x : "<<sample.get_x();
cout << "\nvalue of y : "<<sample.get_y();
return 0;
}
#include <iostream.h>
#include <iomanip.h>
class Point
{
double x,y;
public:
double get_x(return x);
double get_y(return y);
};
//------------------------------------------------
Point:oint (double x1, double y1)
{
x=x1;
y=y1;
}
void Point::changepos (doubble chaposx, double chaposy)
{
x+=chaposx;
y+=chaposy;
}
//-------------------------------------------------
void changepoint (Point)
{
if (T.get_x() < 0) || (T.get_y() < 0)
{ T.chapos (2,5);
cout << "\nPoint x value is "<<T.get_x();
cout << "\nPoint y value is "<<T.get_y();
}
else
cout << "\nNo change of x and y";
}
//-------------------------------------------------
main ()
{
Point sample (6,-4);
cout << "\nvalue of x : "<<sample.get_x();
cout << "\nvalue of y : "<<sample.get_y();
changepoint (sample) ;
cout << "\nvalue of x : "<<sample.get_x();
cout << "\nvalue of y : "<<sample.get_y();
return 0;
}