-->
当前位置:首页 > 题库

PROGRAMMING:(combination class) point is a plane two-dimensional point class, line is a combination class composed of two point points

Luz5年前 (2021-05-10)题库363
Define the plane two-dimensional point class (x, y coordinates, constructor, copy constructor, output function). Line class is a combination class composed of two point points (data member: two endpoints, length of line segment; Function members: constructor, copy constructor, calculate line length function)
//Principal function
int main()
{
int x1,y1,x2,y2;
cin>>x1>>y1;
cin>>x2>>y2;
Point myp1(x1,y1),myp2(x2,y2); // Create the object of the point class
Line L1(myp1,myp2); // Create an object of line class
cout<<"Line start Point is:"; L1.GetPstart().print();
cout<cout<<"Line end Point is:"; L1.GetPend().print();
cout<cout<<"Length of Line is:"<}
###Input format:
Enter two lines. The first line is the starting point coordinate of the line segment (separated by spaces in the middle), and the second line is the ending point coordinate of the line segment (separated by spaces in the middle)
###Output format:
Input the main program of each function called process, which needs to be filled in.
###Input example:
Here is a set of inputs. For example:
```in
0 0
3 4
```
###Output example:
The corresponding output is given here. For example:
```out
create P oint:P (0,0)
create P oint:P (3,4)
Create a new Line:
Line start Point is:P(0,0)
Line end Point is:P(3,4)
Length of Line is:5
```







answer:If there is no answer, please comment