帮我看看求二次函数的C语言程序,要求要用函数来写,
来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/04/27 21:41:01
帮我看看求二次函数的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("没有实根");
}
#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("没有实根");
}
我已经按你的意思修改了,也运行出来了,希望对你有帮助,代码附带在下面:
#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");
}
#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");
}
帮我看看求二次函数的C语言程序,要求要用函数来写,
求高手帮我看看我写的这道C语言程序哪里错了!
来帮我看看已知一个二次函数图像的对称轴是直线x=1,且经过(0,3)(3,0).求这个二次函数的解析式.注,我要具体的解
帮我改下C语言的程序,编程求n门课程的平均成绩.分别用三个函数实现课程成绩的输入,平均.
用c语言调用函数写个程序,求方程ax*x+bx+c=0的根,要求用3个函数分别求当b*b-4ac大于零、等于零
急!高分!请帮我用C语言STATIC函数编一个简单程序
C语言程序“编写由三角形三边求面积的函数”要求必须使用函数调用.还要用到海伦公式.
我有需要求一个函数的值,但是函数中有一个虚数i,我该怎么用C语言编写求函数值的程序
用C语言编译一个简单计算器的程序,要求其中有括号和幂函数
C语言程序题:1、编写一个求n!的函数fact(n),要求fact函数分别用递归和非递归两种方法实现
C语言 编写程序 求下列分段函数的值
C语言大神帮看看这个程序怎么写啊