c++改变输出形式

//set format to #.###
  ios_base::fmtflags orig = cout.setf(ios_base::fixed, ios_base::floatfield);
  std::streamsize prec = cout.precision(3);
//set format to #.##
  cout.precision(2);
//restore original format
  cout.setf(orig, ios_base::floatfield);
  cout.precision(prec);

你可能感兴趣的:(c++,开发语言,后端)