这种问题应该怎么样做啊
#include<stdio.h>
#include<math.h>
void main()
{
float fdayu(float,float,float);
float fdeyu(float,float,float);
float fxiyu(float,float,float);
float a,b,c,d,e,f,g;
printf("Please insert 3 numbers:\n");
scanf("%f%f%f",&a,&b,&c);
if((b*b-4*a*c) > 0)
d = fdayu(a,b,c);
if((b*b-4*a*c) == 0)
d = fdeyu(a,b,c);
if((b*b-4*a*c) < 0)
d = fxiyu(a,b,c);
printf("%f",d);
}
float fdayu(float x,float y,float z)
{
int t,k;
t = (-y + sqrt(y * y - 4 * x * z))/(2 * x);
k = (-y - sqrt(y * y - 4 * x * z))/(2 * x);
return (t,k);
}
float fdeyu(float x,float y,float z)
{
int t,k;
t = (-y + sqrt(y * y - 4 * x * z))/(2 * x);
k = (-y - sqrt(y * y - 4 * x * z))/(2 * x);
return (t,k);
}
float fxiyu(float x,float y,float z)
{
int t,k;
t = (-y + sqrt(y * y - 4 * x * z))/(2 * x);
k = (-y - sqrt(y * y - 4 * x * z))/(2 * x);
return (t,k);
}
题目是求方程ax(2)+bx+c = 0{中的x(2)表示x的平方}的根,用3个函数分别求当b平方-4ac大于0,等于0和小于0时的根并输出结果,两个整数由键盘输入!
#include<math.h>
void main()
{
float fdayu(float,float,float);
float fdeyu(float,float,float);
float fxiyu(float,float,float);
float a,b,c,d,e,f,g;
printf("Please insert 3 numbers:\n");
scanf("%f%f%f",&a,&b,&c);
if((b*b-4*a*c) > 0)
d = fdayu(a,b,c);
if((b*b-4*a*c) == 0)
d = fdeyu(a,b,c);
if((b*b-4*a*c) < 0)
d = fxiyu(a,b,c);
printf("%f",d);
}
float fdayu(float x,float y,float z)
{
int t,k;
t = (-y + sqrt(y * y - 4 * x * z))/(2 * x);
k = (-y - sqrt(y * y - 4 * x * z))/(2 * x);
return (t,k);
}
float fdeyu(float x,float y,float z)
{
int t,k;
t = (-y + sqrt(y * y - 4 * x * z))/(2 * x);
k = (-y - sqrt(y * y - 4 * x * z))/(2 * x);
return (t,k);
}
float fxiyu(float x,float y,float z)
{
int t,k;
t = (-y + sqrt(y * y - 4 * x * z))/(2 * x);
k = (-y - sqrt(y * y - 4 * x * z))/(2 * x);
return (t,k);
}
题目是求方程ax(2)+bx+c = 0{中的x(2)表示x的平方}的根,用3个函数分别求当b平方-4ac大于0,等于0和小于0时的根并输出结果,两个整数由键盘输入!