蓝森林首页 | 返回主页 | 本站地图 | 站内搜索 | 联系信箱 |
 您目前的位置:首页 > 自由软件 > 技术交流 > 应用编程


    

蓝森林 http://www.lslnet.com 2006年6月6日 10:18


[求助] math.h 下的 floor()函数

[code]
#include <stdio.h>
#include <math.h>
main()
{
printf("%d",floor(100.23));
getch();
}
[/code]

为什么我这里的返回是0;

谁能帮帮我

man floor

  double floor(double x);
知道了嘛?

在GCC2.95下调试楼主的程序是由输出的,我也不理解

楼主,你用整型("%d")去诠释一个存浮点数的内存(floor的返回值),当然不行了,这样改:

1. printf("%f",floor(100.23));

2.printf("%d",(int)floor(100.23));



Copyright © 1999-2000 LSLNET.COM. All rights reserved. 蓝森林网站 版权所有。 E-mail : webmaster@lslnet.com