大虾指导
#include <stdio.h>double f(double a, double b, double c, double x)
{
double n;
n=a*x*x+b*x+c;
return n;
}
void main()
{
double a,b,c,x;
printf("Please enter a: ");
scanf("%f",&a);
printf("Please enter b: ");
scanf("%f",&b);
printf("Please enter c: ");
scanf("%f",&c);
printf("Please enter x: ");
scanf("%f",&x);
printf("The polynomial %2.1fx^2+%2.1fx+%2.1f at the point x=%2.1f is %2.1f",a,b,c,x,f(a,b,c,x));
}
为什么最后运行出来的是0.0x^2+0.0x-1.&=-1.& 这样的结果? 顺便这道题有没有简便点的方法,觉得这个方法太累赘了 但是也需要用一个