问个笨问题 问个笨问题:double WPropertion = picctrlWidth/ imageWidth ;wpropertion的值是多少,其中picctrlWidth=466,imageWidth=567 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 double的精度是16位,应该是0.0000 0000 0000 000picctrlWidth和imageWidth为int型,picctrlWidth/ imageWidth = 0;然后强制转换为double应该是上面那个数 如果是这样int picctrlWidth=466,imageWidth=567;double WPropertion = picctrlWidth/ imageWidth ;结果为0如是这样int picctrlWidth=466,imageWidth=567;double WPropertion = (double)picctrlWidth/ imageWidth ;结果是我1楼的 #include "stdafx.h"int main(int argc, char* argv[]){ int picctrlWidth=466; int imageWidth=567; double WPropertion = picctrlWidth/ imageWidth ; printf("%d\n",WPropertion); return 0;}结果为:0 double WPropertion = picctrlWidth/ imageWidth ;先计算后赋值, 计算的结果按整数,是0, 0 赋值给double,还是0 为什么CreateWindow创建AtlAxWin是为什么会打开网页啊? 小问题。。 如何让多个线程在同一时刻开始执行代码 请问什么是计算两图的 欧几里德 距离? 如何ACCESS数据库中删除指定记录?? 请问关于ip包头里的源地址和目标地址的问题 怎么改变chm格式的电子书里字体大小,我这里看的很小,很不爽~~~~~ 如何将16位真彩色的位图转换成24位色真彩色的位图,一定给高分! 请问怎么读取数据的前12位。 怎样接收一个ComboBox中的Enter键输入? 图怎么读进文件中 有关格式化字符串的问题。
picctrlWidth和imageWidth为int型,picctrlWidth/ imageWidth = 0;然后强制转换为double
应该是上面那个数
int picctrlWidth=466,imageWidth=567;
double WPropertion = picctrlWidth/ imageWidth ;
结果为0
如是这样
int picctrlWidth=466,imageWidth=567;
double WPropertion = (double)picctrlWidth/ imageWidth ;
结果是我1楼的
#include "stdafx.h"int main(int argc, char* argv[])
{
int picctrlWidth=466;
int imageWidth=567; double WPropertion = picctrlWidth/ imageWidth ;
printf("%d\n",WPropertion);
return 0;
}
结果为:0
先计算后赋值, 计算的结果按整数,是0, 0 赋值给double,还是0