Home > Back-end >  function
function

Time:06-02

#include
#include
Int plus (float x, float y);
Int red (m float, float n);
Float area (a, float p, float float b, float c);
Int plus (float x, float y)
{
Return (x> Y);
}
Int red (m float, float n)
{
Return (m}
Float area (a, float p, float float b, float c)
{int t;
T=SQRT (p * a * b * c);
}
Void main ()
{
Float a, b, c, t;
Int I, j, p;
P=(a + b + c)/2;
Printf (" please enter you need to determine three number: ");
The scanf (" % % 2 f, 2 f. % 2 f ", & amp; A, & amp; B, & amp; c);
I=plus (a + b, c) & amp; & + c plus (a, b) & amp; & Plus (b + c, a);
J=red (a - b, c) & amp; & Red (a, c, b) & amp; & Red (b, c, a);
If (I | j)
Printf (" the three Numbers don't make a triangle ");
The else
T=area (a, p, p - p - b, p - c);
Printf (" % f ", t);
}
Help to see if there has a problem, subject requirements are 3 are floating point Numbers in the input, use function respectively determine whether can form a triangle, triangle area is also expressed in function calculation

CodePudding user response:

P=(a + b + c)/2; First ABC hasn't enter, first it is wrong to calculate p
Secondly if the judge whether the else is wrong? Not on both sides and a triangle were greater than the third? That is I is 0, enter the if branch

CodePudding user response:

Oh oh, crab crab, I change

CodePudding user response:

#include

#include

Int plus (float x, float y);

Int red (m float, float n);

Float area (a, float p, float float b, float c);

Int plus (float x, float y)

{return (x> Y);

}

Int red (m float, float n)

{return (m
}

Float area (a, float p, float float b, float c)

{

Return (SQRT (p * a * b * c));

}

Int main ()

{float a, b, c, t;

Int I, j, p;

Printf (" please enter your judgment on the number of three: ");

The scanf (" % f % f % f ", & amp; A, & amp; B, & amp; c);

P=(a + b + c)/2;

I=plus (a + b, c) & amp; & + c plus (a, b) & amp; & Plus (b + c, a);

J=red (a - b, c) & amp; & Red (a, c, b) & amp; & Plus (b, c, a);

If (I==1 & amp; & J==1)

{

T=area (p, a - p, b - p, c - p).

Printf (" % f ", t);

}

The else

Printf (" input the number of three cannot constitute a triangle ");

}

CodePudding user response:

Why or not, see

CodePudding user response:

J=red (a - b, c) & amp; & Red (a, c, b) & amp; & plus (b, c, a);

CodePudding user response:

T=area (a, p, p - p - b, p - c); Need in this way, not t=area (p, a - p, b - p, c - p).

CodePudding user response:

Fun
reference 5 floor response:
j=red (a - b, c) & amp; & Red (a, c, b) & amp; & plus (b, c, a);

Oh oh oh, too careless

CodePudding user response:

Fun
reference 6 floor response:
t=area (a, p, p - p - b, p - c); Need in this way, not t=area (p, a - p, b - p, c - p).

I think is right, but when playing too fast, you made a mistake

CodePudding user response:

Fun
reference 6 floor response:
t=area (a, p, p - p - b, p - c); Need in this way, not t=area (p, a - p, b - p, c - p).

Other should be no problem for the

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