I am bit confuse about this assignment my professor gave me. I had coded "most" of the main parts for this construction but in the <int main()>. I stuck on the part where it ask for the length of each side from vertex. I do not know what to put for the {cout<<"side length"}. Could any kind heart help me on this small part?
Much appreciate in advance.
Here's the construction I got so far:
#include <iostream>
usingnamespace std;
class POINT
{
private: float x, y;
public: void Read() {cin>>x>>y;}
void Show() {cout<<"("<<x<<","<<y<<")";}
//find and return the distance from p to q
friendfloat Distance(POINT p, POINT q)
{
return sqrt( (p.x-q.x)*(p.x-q.x)+(p.y-q.y)*(p.y-q.y));
}
};
int main()
{
POINT A,B,C,D;
cout<<"To draw a rectangle, please\n"<<"\tEnter the coefficient of vertex A: ";
A.Read();
cout<<"\tEnter the coefficient of vertex B: ";
B.Read();
cout<<"\tEnter the coefficient of vertex C: ";
C.Read();
cout<<"\tEnter the coefficient of vertex D: ";
D.Read();
A.Show(); cout<<"--------";
B.Show();
cout<<"\n |"<<"\t"<<" |"<<"\n"
<<" |"<<"\t"<<" |"<<"\n";
C.Show(); cout<<"--------";
D.Show(); cout << "\n";
Distance (A,B);
cout<<"Length of the side AB= " //<<-----What can I put here?
; cout<<"\n"; //<
Distance (B,D);
cout<<"Length of the side BD= " //<<-----What can I put here?
; cout<<"\n";
//Terminate
system("pause");
return 0;
}