ceil, floor, round 新人

#include

include

int main()
{
float a;
while((scanf("%.1f",&a)!=EOF))
{
printf("%d ",ceil(a));
printf("%d ",floor(a));
printf("%d ",round(a));
}
return 0;
}

1604.obj : error LNK2001: unresolved external symbol _round
Debug/1604.exe : fatal error LNK1120: 1 unresolved externals

Description
在很多编程语言的库中,都提供了很多函数,能大大方便我们的编程。就比如ceil,floor,round函数:

ceil:向上取整,如ceil(1.2)结果为2;

floor:向下取整,如floor(1.9)结果为1;

round:四舍五入,如果round(1.4)为1,round(1.5)为2。

现在要你输出一个数的这三种函数值。

round函数需要自己编辑吗

 #include <math.h>

另外round也可以自己实现
int my round(double d)
{
return (int)(d + 0.5);
}