2 回答

FFIVE
TA貢獻1797條經(jīng)驗 獲得超6個贊
C++里標準輸入輸出使用的格式化標志之一
如:
setf (ios_base: :showpoint)//是設(shè)置小數(shù)點模式
就是說,設(shè)定為showpoint后,在不必要的時候也顯示10進數(shù)的小數(shù)點以及其后的0
參考例子:
// modify showpoint flag
#include <iostream>
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;
return 0;
}
The execution of this example displays something similar to:
30.000 10000. 3.1416
30 10000 3.1416
- 2 回答
- 0 關(guān)注
- 1225 瀏覽
添加回答
舉報
0/150
提交
取消