2 回答

FFIVE
TA貢獻1797條經驗 獲得超6個贊
C++里標準輸入輸出使用的格式化標志之一
如:
setf (ios_base: :showpoint)//是設置小數點模式
就是說,設定為showpoint后,在不必要的時候也顯示10進數的小數點以及其后的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 關注
- 1216 瀏覽
添加回答
舉報
0/150
提交
取消