|
蓝森林 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)); |
| |