#include<math.h> #include<stdio.h> #define PI 3.14 typedef struct Point { double x; double y; }Point; typedef struct Line { Point a; Point b; }Line; double angle(Line l1,Line l2) { double k1,k2; double angle; k1=(l1.a.y-l1.b.y)/(l1.a.x-l1.b.x); k2=(l2.a.y-l2.b.y)/(l2.a.x-l2.b.x); angle = atan(abs(k1-k2)/(1+k1*k2)); return angle; } int main() { Line l1,l2; l1.a.x=0; l1.a.y=0; l1.b.x=1; l1.b.y=1; l2.a.x=0; l2.a.y=0; l2.b.x=1; l2.b.y=0; printf("%f\n",angle(l1,l2)*180/PI); return 0; }