# include
# include
int main(void)
{
int a = 4 ;
int b = 5 ;
int c = 9 ;
double delta ;
double x1 ;
double x2 ;
delta = b*b - 4*a*c ;
if (delta > 0)
{
x1 = (-b + sqrt(delta)) / (2*a) ;
x2 = (-b - sqrt(delta)) / (2*a) ;
printf("x1 = %f, x2 = %f\n",x1 ,x2) ;
}
else if (delta == 0)
{
x1 = (-b) / (2*a);
x2 = x1;
printf("x1 = x2 = %f\n",x1) ;
}
else if(delta < 0) //这里如果没有IF的话esle是不能跟条件的
{ //error C2143: 语法错误 : 缺少“;”(在“{”的前面
printf("无解\n") ;
}
return 0 ;
}
最好能把代码都贴上来
我不会c++啊...