Home > Back-end >  Why the output 1 # R solving, next thanks!!!!!!
Why the output 1 # R solving, next thanks!!!!!!

Time:06-05

This is the code, the following questions, I run the topic to the data, area of abnormal output, when I enter

3, 4, 5
Output is 1. # R 12.00
Area, perimeter, strives for the answer, thank you!!!
* * * * * * * * * * * * * * * * * * *


#include
Double as (double [], a double [] b, double c []);
Double qsa (double a1 [], a double b1 [], a double c1 []);
Struct student
{
Double b1 [100];
Double b2 [100];
Double b3 [100];
} ss [100];
Int main (void)
{
Double * g * h * j, b5.
Int I, n;
The scanf (" % d ", & amp; N);
for(i=0; I & lt; n; I++)
{
Lf the scanf (" % % % lf lf ", & amp; Ss [I]. B1 [I], & amp; Ss [I]. [I] b2, & amp; Ss [I]. B3 [I]);
G=ss [I]. B1; H=ss [I]. B2. J=ss [I] b3.
As (g, h, j);
B5 as=(g, h, j);
If (b5==0)
{
Printf (" not ");
}
The else
{
Double area=b5 * (b5 - ss [I]. B1 [I]) * (b5 - ss [I]. [I] b2) * (b5 - ss [I] b3 [I]);
Printf (" % % 2 f, 2 f \ n ", area, ss [I]. B1 + ss [I]. [I] b2 + ss [I]. [I] b3 [I]);
}
}
}
Double as (double [], a double [] b, double c [])
{
Double * y1, y2, y3.
Y1=a; Y2=b; Y3=c;
If ((* + * y1 y2 & gt; * y3) & amp; & (* * y1 + y3 & gt; * y2) & amp; & (* y2 y3 + * & gt; * y1))
{
Qsa (y1, y2, y3);
}
The else
{
Int k=0;
The return of k;
}
}
Double qsa (double a1 [], a double b1 [], a double c1 [])
{
Double s;
O1, double * * o2, o3;
O1=a1;
O2=b1;
O3=c1;
S=(* o1 + o2 + * * o3)/2;
return s;
}

* * * * * * * * * * * * * * * * *
The Description
Enter the three sides of the triangle a, b, c, if we can form a triangle, the output area of area and perimeter generating (keep 2 decimal places). Otherwise, output "not", (in a triangle arbitrary on both sides of the sum is greater than the third side, the area of a triangle formula: area="s (s - a) (b) s (s - c)" the square root of, among them: s=(a + b + c)/2), to code isTriangle and call the three functions are defined, triangleArea and trianglePerimeter were used to determine three side can form a triangle, the area of a triangle and seeking for the perimeter of the triangle,
Input
The first line is an integer I said I set of test data;
Each group has three positive integers, representing the three sides of the triangle a, b, c
The Output
For each set of test, if three side can form a triangle, then output the area of the triangle area and perimeter perimete and results keep two decimal places if three side cannot form a triangle, then output "not"
The Sample Input
2
3, 4, 5
1 2 1
The Sample Output
6.00 12.00
The not

CodePudding user response:

I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.html
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html
  • Related