#include 学习<第三记> showpoint , noshowpoint

就是说,设定为showpoint后,在不必要的时候也显示10进数的[小数点]以及其后的0

#include
#include
using namespace std;
int main()
{
    double a, b, pi;
    a = 30.0;
    b = 10000.0;
    pi = 3.1416;
    cout.precision(5);  //设置输出长度
    cout << showpoint << a << '\t' << b << '\t' << pi << endl;
    cout << noshowpoint << a << '\t' << b << '\t' << pi << endl;
}

//输出
30.000  10000.  3.1416
30      10000   3.1416

你可能感兴趣的:(#include 学习<第三记> showpoint , noshowpoint)