范例代码如下:
#include <iostream>
using namespace std;
int main()
{
double dRet = 0;
float ftRet = 0;
int nRet = 0;
for (int i = 0; i < 640 * 480; ++i) {
dRet += 273.0;
ftRet += 273.0;
nRet += 273;
}
cout << "dRet: "<< dRet << endl;
cout << "ftRet: " << ftRet<<endl;
cout << "nRet: " << nRet << endl;
}
结果:
dRet: 8.38656e+07
ftRet: 8.36199e+07
nRet: 83865600