吉林大学毕业证图片:懂vc的近来看看

来源:百度文库 编辑:神马品牌网 时间:2024/05/09 19:39:35
#include "stdafx.h"
#include "stdio.h"
#include "math.h"
void main()
{
float a,b,c,disc,x1,x2,realpart,imagpart;
scanf("%f,%f,%f",&a,b,&c);
printf("The equation");
if(fabs(a)<=(le-6))
printf("is not a quadratic\n");
else
{
disc=b*b-4*a*c;
if (fabs(disc)<=le-6)
printf("has two equal root: %8.4f\n",-b/(2*a));
else
if(disc>le-6)
{
x1=(-b+sqrt(disc))/(2*a);
x2=(-b-sqrt(disc))/(2*a);
printf("has distinct real roots:%8.4f and %8.4f and %8.4f\n",x1,x2);
}
else
{
realpart=-b/(2*a);
imagpart=sqrt(-disc)/(2*a);
printf("has complex roots: \n");
printf("%8.4f+8.4fi\n",realpart,imagpart);
printf("%8.4f-8.4fi\n",realpart,imagpart);
}
}
}
这样一个编程! 结果不能运行,说是D:\Program Files\Microsoft Visual Studio\MyProjects\gongcheng\gongcheng.cpp(12) : error C2065: 'le' : undeclared identifier
是怎么回事呢!!! 有点不懂!! 解释一下!

if(fabs(a)<=(le-6)) 中le不对
应该是1e-6. 01234的1,不是jklm的l
scanf("%f,%f,%f",&a,b,&c); =>scanf("%f,%f,%f",&a,&b,&c);
printf("has distinct real roots:%8.4f and %8.4f and %8.4f\n",x1,x2); =>printf("has distinct real roots:%8.4f and %8.4f\n",x1,x2);

printf("%8.4f+8.4fi\n",realpart,imagpart); =>printf("%8.4f+%8.4fi\n",realpart,imagpart);

le是什么东西,常量?变量?宏常数?

再是,为什么scanf("%f,%f,%f",&a,b,&c);这句里的变量b看起来怎么这么不协调?

还有看这几句:
printf("has distinct real roots:%8.4f and %8.4f and %8.4f\n",x1,x2);
就程序而言,这里是不是多了(或是少了)点什么?
printf("%8.4f+8.4fi\n",realpart,imagpart);
printf("%8.4f-8.4fi\n",realpart,imagpart);
为什么后面有两个参数?

另外提个建议:在确定你需要的数值类型是float时,最好在计算时将其他类型的数据转换成float类型.

if(disc>le-6)中,变量le没有声明。