大佬求帮忙看看哪里出错了,就是玩不了
#include <stdio.h>#include <math.h>
int main(void)
{
int a = 1;
int b = 2;
int c = 3;
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
{
("该方程无解\n");
}
return 0;
} 。。。
else
{
printf("该方程无解\n"); //少打了printf
}
return 0;
页:
[1]