C语言一元二次方程求解# include# includeint main(){\x09int a = 1;\x09int b = 2;\x09int c = 3;\x09double del;\x09double x1;double x2;\x09del = b*b - 4*a*c;\x09if (del > 0)\x09{\x09\x09x1 = (-b + sprt(del)) / (2*a);\x09\x09x2 = (-b - sprt(del)

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/14 21:08:24

C语言一元二次方程求解# include# includeint main(){\x09int a = 1;\x09int b = 2;\x09int c = 3;\x09double del;\x09double x1;double x2;\x09del = b*b - 4*a*c;\x09if (del > 0)\x09{\x09\x09x1 = (-b + sprt(del)) / (2*a);\x09\x09x2 = (-b - sprt(del)
C语言一元二次方程求解
# include
# include
int main()
{
\x09int a = 1;
\x09int b = 2;
\x09int c = 3;
\x09double del;
\x09double x1;
double x2;
\x09del = b*b - 4*a*c;
\x09if (del > 0)
\x09{
\x09\x09x1 = (-b + sprt(del)) / (2*a);
\x09\x09x2 = (-b - sprt(del)) / (2*a);
\x09\x09printf("一元二次方程的两个解:x1=%f,x2=%f\n",x1,x2);
\x09}
\x09else if (del == 0)
\x09{
\x09\x09x1 = (-b) / (2*a);
\x09\x09x2 = x1;
\x09\x09printf("一元二次方程的唯一一个解:x1 = x2 = %f\n",x1);
\x09}
\x09else
\x09{
\x09\x09printf("无解\n");
\x09}
\x09return 0;
}
error C2065:'sprt' :undeclared identifier
执行 cl.exe 时出错.
yiyuanercifangcheng.obj - 1 error(s),0 warning(s)

C语言一元二次方程求解# include# includeint main(){\x09int a = 1;\x09int b = 2;\x09int c = 3;\x09double del;\x09double x1;double x2;\x09del = b*b - 4*a*c;\x09if (del > 0)\x09{\x09\x09x1 = (-b + sprt(del)) / (2*a);\x09\x09x2 = (-b - sprt(del)
double改做float