C++输出格式:fixed,precision(),setf(iOS_base::showpoint)的含义

cout<<fixed  //用一般的方式输出浮点型,例如C++程序在控制台显示的时候大一点的数,显示的时候使用了科学计数法,使用该命令即可像一般的方式显示

cout.precision(2) //设置精确度为2,并返回上一次的设置。

cout.setf(iOS_base::showpoint)  //显示浮点数小数点后面的零。


原文:https://blog.csdn.net/septemberAs/article/details/68489554

猜你喜欢

转载自blog.csdn.net/tttabcgy/article/details/80101037