Home > Back-end >  Look, the result is wrong, should be an int and float into error
Look, the result is wrong, should be an int and float into error

Time:11-11

# include
# include
Int x (a, b, D)
{
Int x1, x2,
X1=(a - b + SQRT (D))/(2 * a);
X2=(a - b - SQRT (D))/(2 * a);
Printf (" function has two different solutions for % d, % d ", x1, x2);
return 0;
}
Int y (a, b, D)
{
Int x1, x2,
The x1 x2==(a - b)/(2 * a);
Printf (" % d function has two of the same solution ", the x1 x2=);
return 0;
}
Int z (a, b, D)
{
Int d1, d2, e;
D1=(SQRT (3-d))/(2 * a);
D2=(SQRT (D))/(2 * a);
E=(a - b)/(2 * a);
Printf (" function, there are two different imaginary root + % d % d * I, % d, % d * I ", e, d1, e, d2);
return 0;
}

Int main ()
{
Int a, b, c, D;
Printf (" please enter their ordinal number ");
Scanf_s (" % d % d % d ", & amp; A, & amp; B, & amp; C);
D=b * * a * b - 4 c.
If (D & gt; 0)
{
X (a, b, D);
}
Else if (D==0)
{
Y (a, b, D);
}
The else
{
Z (a, b, D);
}
return 0;
}

CodePudding user response:

Void x (a, b, D)
{
Double x1, x2,
X1=(a - b + SQRT (D))/(2 * a);
X2=(a - b - SQRT (D))/(2 * a);
Printf (" % f function has two different solutions, % f ", x1, x2);
}
Void y (a, b, D)
{
Double x1, x2,
The x1 x2==1.0 * b/(2 * a);
Printf (" % f "function has two of the same solution, the x1 x2=);
}
Void z (a, b, D)
{
Double d1, d2, e;
D1=SQRT (D)/(2 * a);
D2=SQRT (D)/(2 * a);
B/e=1.0 * (2 * a);
Printf (" function, there are two different imaginary root % f + % f * I, % f, % f * I ", e, d1, e, d2);
}

CodePudding user response:

Double d1, d2, e; Double or float should use the format of the operator is % f

CodePudding user response:

Int x (a, b, D)
{
/* */
}

Function prototype without prior statement that defines the body of the function, the compiler can pass?

CodePudding user response:

Why can't through ~ ~ ~

CodePudding user response:

to learn basic!