It is a mathematical question, and then calls the inverse trigonometric function. Consider the situation of the Four Coordinate Systems and consider it clearly.
[Cpp]
# Include "stdio. h"
# Include "string. h"
# Include "stdlib. h"
# Include "math. h"
# Include "algorithm"
# Include "iostream"
Using namespace std;
# Define PI 3.1415926
Int main ()
{
Int n;
Double x1, y1, x2, y2, tempa, tempb, temp;
Scanf ("% d", & n );
{
While (n --)
{
Scanf ("% lf", & x1, & y1, & x2, & y2 );
// Cout <x1 <y1 <x2 <y2;
If (x1 * x2> 0 & y1 * y2> = 0)
{
Tempa = atan (y1/x1 );
Tempb = atan (y2/x2 );
Temp = fabs (tempa-tempb );
// Cout <tempa <endl <tempb <endl <temp <endl;
}
Else
If (x1 * x2> 0 & y1 * y2 <= 0)
{
Y1 = fabs (y1 );
Y2 = fabs (y2 );
Tempa = atan (y1/x1 );
Tempb = atan (y2/x2 );
Temp = tempa + tempb;
}
Else
If (x1 * x2 <0 & y1 * y2> = 0)
{
X1 = fabs (x1 );
X2 = fabs (x2 );
Tempa = atan (y1/x1 );
Tempb = atan (y2/x2 );
Temp = PI-fabs (tempa-tempb );
}
Else
If (x1 * x2 <0 & y1 * y2 <= 0)
{
X1 = fabs (x1 );
X2 = fabs (x2 );
Y1 = fabs (y1 );
Y2 = fabs (y2 );
Tempa = atan (y1/x1 );
Tempb = atan (y2/x2 );
Temp = PI + fabs (tempa-tempb );
}
Printf ("%. 2lf \ n", temp * 180/PI );
}
}
Return 0;
}
# Include "stdio. h"
# Include "string. h"
# Include "stdlib. h"
# Include "math. h"
# Include "algorithm"
# Include "iostream"
Using namespace std;
# Define PI 3.1415926
Int main ()
{
Int n;
Double x1, y1, x2, y2, tempa, tempb, temp;
Scanf ("% d", & n );
{
While (n --)
{
Scanf ("% lf", & x1, & y1, & x2, & y2 );
// Cout <x1 <y1 <x2 <y2;
If (x1 * x2> 0 & y1 * y2> = 0)
{
Tempa = atan (y1/x1 );
Tempb = atan (y2/x2 );
Temp = fabs (tempa-tempb );
// Cout <tempa <endl <tempb <endl <temp <endl;
}
Else
If (x1 * x2> 0 & y1 * y2 <= 0)
{
Y1 = fabs (y1 );
Y2 = fabs (y2 );
Tempa = atan (y1/x1 );
Tempb = atan (y2/x2 );
Temp = tempa + tempb;
}
Else
If (x1 * x2 <0 & y1 * y2> = 0)
{
X1 = fabs (x1 );
X2 = fabs (x2 );
Tempa = atan (y1/x1 );
Tempb = atan (y2/x2 );
Temp = PI-fabs (tempa-tempb );
}
Else
If (x1 * x2 <0 & y1 * y2 <= 0)
{
X1 = fabs (x1 );
X2 = fabs (x2 );
Y1 = fabs (y1 );
Y2 = fabs (y2 );
Tempa = atan (y1/x1 );
Tempb = atan (y2/x2 );
Temp = PI + fabs (tempa-tempb );
}
Printf ("%. 2lf \ n", temp * 180/PI );
}
}
Return 0;
}