705.cpp
来自「C++实训教程」· C++ 代码 · 共 26 行
CPP
26 行
//705.CPP demo use stream format
#include <iostream.h>
main(void)
{
cout.setf(ios::showpos);
cout.setf(ios::scientific);
cout << 123 << " "<< 123.456 << endl;
cout.precision(3);// two digits after decimal point
cout.width(10);// in a field of ten characters
cout << 123 << " "<< 123.456 << endl;;
cout.fill('#');// fill using#
cout.width(10);// in a field of ten characters
cout.unsetf(ios::scientific|ios::showpos);
cout.precision(5);// two digits after decimal point
cout << 123 << " " << 123.456;
return 0;
}
/*-
+123 +1.234560e+02
+123 +1.235e+02
#######123 123.46
*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?