帮我看看求二次函数的C语言程序,要求要用函数来写,#include#includedouble t,x1,x2;void main(){void situ1(double a,double b,double c);void situ2(double a,double b,double c);void situ3();double x,a,b,c;scanf("%lf%lf%lf",&a,&b,&c);if (

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/14 21:39:04
帮我看看求二次函数的C语言程序,要求要用函数来写,#include#includedouble t,x1,x2;void main(){void situ1(double a,double b,double c);void situ2(double a,double b,double c);void situ3();double x,a,b,c;scanf(
xT]oP:`FZ< ʍh B1M%!4qDF`.3=ʿ`OO?)t]9}~==)4h6ůy/Ekqy.ZodB!xR+UgbPQ+g05oj;(љټ v6o5(@󭲠HLr&; SL0eR)iߊXaò(w= &MW-0 @XmZƗ"WkjFI~bZ

帮我看看求二次函数的C语言程序,要求要用函数来写,#include#includedouble t,x1,x2;void main(){void situ1(double a,double b,double c);void situ2(double a,double b,double c);void situ3();double x,a,b,c;scanf("%lf%lf%lf",&a,&b,&c);if (
帮我看看求二次函数的C语言程序,要求要用函数来写,
#include
#include
double t,x1,x2;
void main()
{
void situ1(double a,double b,double c);
void situ2(double a,double b,double c);
void situ3();
double x,a,b,c;
scanf("%lf%lf%lf",&a,&b,&c);
if (a=0)
x=c/b;
else
{
\x05t=b*b-4*a*c;
\x05if (t>0)
\x05\x05situ1(a,b,c);
\x05else if(t=0)
\x05\x05situ2(a,b,c);
\x05else
\x05\x05situ3();
\x05
}
}
void situ1(double a,double b,double c)
{
\x05x1=(-b+sqrt(t))/(2*a);
\x05x2=(-b-sqrt(t))/(2*a);
\x05printf("%lf\t%lf",x1,x2);
}
void situ2(double a,double b,double c)
{
\x05x1=x2=(-b+sqrt(t))/(2*a);
\x05printf("%lf\t%lf",x1,x2);
}
void situ3()
{
\x05printf("没有实根");
}

帮我看看求二次函数的C语言程序,要求要用函数来写,#include#includedouble t,x1,x2;void main(){void situ1(double a,double b,double c);void situ2(double a,double b,double c);void situ3();double x,a,b,c;scanf("%lf%lf%lf",&a,&b,&c);if (
我已经按你的意思修改了,也运行出来了,希望对你有帮助,代码附带在下面:
#include
#include
float t,x1,x2;
void main()
{
void situ1(float a,float b,float c);
void situ2(float a,float b,float c);
void situ3();
float x,a,b,c;
scanf("%f%f%f",&a,&b,&c);
if (a==0)
{
x=-c/b;
printf("x=%.2f\n",x);
}
else
{
t=b*b-4*a*c;
if (t>0)
situ1(a,b,c);
else if(t==0)
situ2(a,b,c);
else
situ3();
}
}
void situ1(float a,float b,float c)
{
x1=(-b+sqrt(t))/(2*a);
x2=(-b-sqrt(t))/(2*a);
printf("x1=%.2f\tx2=%.2f\n",x1,x2);
}
void situ2(float a,float b,float c)
{
x1=x2=(-b+sqrt(t))/(2*a);
printf("x1=x2=%.2f\n",x1);
}
void situ3()
{
printf("没有实根\n");
}