📄 fig11_26.cpp
字号:
// Fig. 11.26: fig11_26.cpp
// Displaying floating-point values in system default,
// scientific, and fixed formats.
#include <iostream.h>
int main()
{
double x = .001234567, y = 1.946e9;
cout << "Displayed in default format:\n"
<< x << '\t' << y << '\n';
cout.setf( ios::scientific, ios::floatfield );
cout << "Displayed in scientific format:\n"
<< x << '\t' << y << '\n';
cout.unsetf( ios::scientific );
cout << "Displayed in default format after unsetf:\n"
<< x << '\t' << y << '\n';
cout.setf( ios::fixed, ios::floatfield );
cout << "Displayed in fixed format:\n"
<< x << '\t' << y << endl;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -