4、编写程序,运行时输入x,a,b,c,输出 y=ax2+bx+c,要求使用函数功能
#include <stdio.h>
int main()
{
double x,a,b,c;
double y;
scanf("%lf %lf %lf %lf",&x,&a,&b,&c);
y = a*x*x + b*x + c;
printf("%lf",y);
return 0;
}
楼上没读题吗?要求用函数写!!!
楼主可以看看我写的
#include <stdio.h>
double ans_Gaim_(double x, double a, double b, double c) {
double ans_;
ans_ = a * x * x + b * x + c;
return ans_;
}
int main() {
double x, a, b, c;
double y;
scanf ("%lf %lf %lf %lf", &x, &a, &b, &c);
y = ans_Gaim_ (x, a, b, c);
printf("%lf",y);
return 0;
}