首页 新闻 会员 周边

C++运算问题

0
悬赏园豆:20 [已关闭问题] 关闭于 2018-03-03 17:15

void OnPositionChange(ULONG nReadBytes,// 当前下载进度
                  ULONG nTotalBytes                  // 总长度
                 ){

int nProgress = nReadBytes * 100 / nTotalBytes;
if (nProgress != Progress) {
        Progress = nProgress;//Progress 为类成员变量

}

}

问题:下载的文件大小为 472346964 b

下载进度到达9%之后  nProgress 从9变为0

也就是说运算出来的nProgress 取值一直是 0~9循环(注 nReadBytes和nTotalBytes取值是正确的)

这是什么原因?

Guozht的主页 Guozht | 初学一级 | 园豆:122
提问于:2018-03-03 17:00
< >
分享
所有回答(1)
0

nReadBytes * 100 越界

Guozht | 园豆:122 (初学一级) | 2018-03-03 17:15
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册