这里提示c(9) : error C2065: 'x' : undeclared identifier和c(9) : error C2106: '=' : le
#include <stdio.h>#include <math.h>
#include <string.h>
void main()
{float a,b,c;
double x1,x2;
printf("请输入a,b,c的值\n");
scanf("%f,%f,%f",&a,&b,&c);
a*x*x+b*x+c=0;
printf("a*x*x+b*x+c=0\n");
{if(a!=0&&b!=0)
{if(b*b-4*a*c>=0)
{x1=(-b+sqrt(b*b-4*a*c))/2*a;
x2=(-b-sqrt(b*b-4*a*c))/2*a;
printf("%f,%f\n",x1,x2);}
else
{printf("该方程无解\n");}}
else
{printf("该方程无解\n");}}
{
if(a!=0&&b==0)
{if(b*b-4*a*c>=0)
{x1=(-b+sqrt(b*b-4*a*c))/2*a;
x2=(-b-sqrt(b*b-4*a*c))/2*a;
printf("%f,%f\n",x1,x2);}
else
{printf("该方程无解\n");}}
else
{x1=-(c/b);
x2=-(c/b);
printf("%f,%f\n",x1,x2);}}
}