4.11 类型转换

版权声明:本文为博主原创文章,未经博主允许不得转载 https://blog.csdn.net/qit1314/article/details/90116359

书中页数:P141
代码名称:warn_dbltoint.cc

#include <iostream>
using std::cout; using std::endl;

int main()
{
	// the compiler might warn about loss of precision
	int ival = 3.541 + 3; // the compiler might warn about loss of precision
	cout << ival << endl;  // prints 6

	return 0;
}

猜你喜欢

转载自blog.csdn.net/qit1314/article/details/90116359