C++精确到小数点后两位取值

借助Round()四舍五入函数:

  
#include <iostream>
#include <string>
using namespace std;

int main()
{
	string str = "2.86923e-010";
	double qwe = std::stod(str);
	double ada = round(qwe * 100) / 100.0;
	return 0;
}

 


版权声明:本文为qq_36568418原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。