能力值:
( LV2,RANK:10 )
|
-
-
|
能力值:
( LV2,RANK:10 )
|
-
-
|
能力值:
( LV2,RANK:10 )
|
-
-
[讨论]DEV C++中初学者编程 共同学习者顶起来
#include "stdio.h"
#include "math.h"
main()
{
float a,b,c,x1,x2,i; /* 设定变量 */
scanf("%f%f%f",&a,&b,&c); /* 输入系数 */
i=pow(b,2)-4*a*c; /* 计算判别式的值 */
if(i>0) /* 分支 */
x1=(-b+sqrt(i))/(2*a),x2=(-b-sqrt(i))/(2*a); /* 此处很多同学少写了括号 */
else if(i==0) /* 注意写语句时分级 */
x1=-b/(2*a),x2=x1;
else printf("No Pass");
fflush(stdin);
getchar();
printf("\n%f%f",x1,x2);
getchar();
}
|