Visual C++ 6.0 中浮点型数据的输入输出和有效位数的问题
程序代码:
#include<stdio.h> int main(void) { double a; double b; double c=1.23456789012345678901234567980123456789; float d; float e; float f=1.23456789012345678901234567890123456789; printf("输入a="); scanf("%f",&a); printf("输入b="); scanf("%lf",&b); printf("输入d="); scanf("%f",&d); printf("输入e="); scanf("%lf",&e); printf("a=%.33f\n",a); printf("b=%.33f\n",b); printf("c=%.33f\n",c); printf("d=%.33f\n",d); printf("e=%.33f\n",e); printf("f=%.33f\n",f); printf("a=%f\n",a); printf("b=%f\n",b); printf("c=%f\n",c); printf("d=%f\n",d); printf("e=%f\n",e); printf("f=%f\n",f); }运行结果:
输入a=1.23456789012345678901234567890123456789
输入b=1.23456789021245678901234567890123456789
输入d=1.23456789012345678901234567890123456789
输入e=1.23456789012345678901234567890123456789
a=-92559604304082489000000000000000000000000000000000000000000000.00000000000000
0000000000000000000
b=1.234567890212456800000000000000000
c=1.234567890123456700000000000000000
d=1.904320955276489300000000000000000
e=70.175743103027344000000000000000000
f=1.234567880630493200000000000000000
a=-92559604304082489000000000000000000000000000000000000000000000.000000
b=1.234568
c=1.234568
d=1.904321
e=70.175743
f=1.234568
Press any key to continue
求解释1.输出的结果a
2.各个结果后面的0的个数
3.double型的输入不能用scanf("%f",&x)?
4.第一组b和c的结果为什么不一样而第二组的b和c结果一样
5.d、e、f的结果
6.等等