well everyone heres the code and I gotta tell yah this one has got me stumped
Code:
#include <iostream>
#include <string>
using namespace std;
class two
{
private: float x, y;
public:
void read()
{
cout<<"Enter the x cooridnate: "; cin>>x; //enter the value for the x coord
cout<<"Enter the y coordinate: "; cin>>y; //enter the value for the y coord
}
void show()
{
cout<<"the x and y of point a are("<<x<<" , "<<y<<")"<<endl; //shows the value of the x and y coord
}
friend void show(two p)
{
cout<<"the x and y of point b are("<<p.x<<" , "<<p.y<<")"<<endl;
}
friend float distance(two p)
{
float d=((0-p.x)(0-p.x)) + (0-p.y)(0-p.y));
cout<<sqrt(d);
}
};
void main()
{
two a, b;//declares two objects a and b
a.read();//read in x and y values for object a
b.read();//read in x and y values for object b
a.show();//show x and y values for object a
show(b);//show x and y values for object b
cout<<"The distance from point(0,0) to point a is" <<distance(b);
}
well according to the info I got on friend functions this stuff should work man but I keep getting this crazy error message that says internal compiler error. Now the one question that I have what exactly am I missing here