#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 pSecondly 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 changeCodePudding 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, seeCodePudding 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