蓝冰幻影 - 2005-7-15 10:48:00
main()
{
long int a,b,c,d,e,f,g,h,i;
scanf("%ld",&a);
b=a%10000;
c=a%1000;
d=a%100;
e=a%10;
f=(a-b)/10000;
g=(b-c)/1000;
h=(c-d)/100;
i=(d-e)/10;
if (a>100000)
printf ("error!");
else if (a>=10000)
{
printf("5\n,%ld,%ld,%ld,%ld,%ld\n",f,g,h,i,e);
printf(" %ld,%ld,%ld,%ld,%ld\n",e,i,h,g,f);
}
else if (a>=1000)
{
printf("4\n,%ld,%ld,%ld,%ld\n",g,h,i,e);
printf(" %ld,%ld,%ld,%ld\n",e,i,h,g);
}
else if (a>=100)
{
printf("3\n,%ld,%ld,%ld\n",h,i,e );
printf(" %ld,%ld,%ld\n",e,i,h );
}
else if (a>=10)
{
printf("2\n,%ld,%ld\n",i,e);
printf(" %ld,%ld\n",e,i);
}
else if (a>=1)
printf("1\n%ld\n",a);
}
其中%ld中的l可不可以去掉??
L.S. - 2005-7-15 12:46:00
去掉,就没有数据输出了。这是数据输出格式控制符
快乐苹果 - 2005-7-17 13:57:00
因为你输出的数据类型是long int(即长整型),所以要用%ld
快乐苹果 - 2005-7-17 13:59:00
double型,用%lf或%le
float型,用%f或%e
© 2000 - 2024 Rising Corp. Ltd.