1 #include2 #include 3 #include 4 #include 5 using namespace std; 6 struct point{ 7 int x,y; 8 point(int x = 0,int y = 0){ 9 this->x = x;10 this->y = y;11 }12 };13 struct line{14 point st,en;15 line(){}16 };17 class Intersect {18 private:19 line la,lb;20 public:21 void readData();22 void process();23 bool isCross();//24 bool isSameLine();25 };26 void Intersect::readData(){27 point p1,p2,p3,p4;28 cin>>p1.x>>p1.y>>p2.x>>p2.y>>p3.x>>p3.y>>p4.x>>p4.y;29 la.st = p1;la.en = p2;30 lb.st = p3;lb.en = p4;31 }32 void Intersect::process(){33 if(isCross()){34 //求出交点35 double A1 = la.st.y - la.en.y,B1 = la.en.x - la.st.x;36 double C1 = la.st.x * la.en.y - la.st.y * la.en.x;//A1,B1,C1是方程系数37 double A2 = lb.st.y - lb.en.y,B2 = lb.en.x - lb.st.x;38 double C2 = lb.st.x * lb.en.y - lb.st.y * lb.en.x;39 double x = (B1*C2 - B2*C1)/(A1*B2 - A2*B1);40 double y = (C1*A2 - C2*A1)/(A1*B2 - A2*B1);//方程的解41 printf("POINT %.2lf %.2lf\n",x,y);42 }43 else{44 if(isSameLine()==0){45 cout<<"LINE"< >cases){70 cout<<"INTERSECTING LINES OUTPUT"<