|
5#
楼主 |
发表于 2013-3-17 14:54:15
|
只看该作者
谢谢,解决了
[code=AS3 width=740px]float tdec(float a);
#include <stdio.h>
#include <stdlib.h>
main()
{
float b,c;
scanf("%f",&b);
c=tdec(b);
printf("%g",c);
system("pause");
return 0;
}
float tdec(float a)
{ int a0=a;
while(a>1)
{ a--;
}
while(a<1)
{ a++;
}
if(a0>0)
return a-1;
if(a0<0)
return -(2-fabs(a));
}
[/code] |
|