iomanip在c程序中经常看到以下头文件#include : io表示输入输出,manip是manipulator (机械手)的缩写)在c中只对输入缩写有效。
具体使用方法:
# include iostream # includeiomanipusingnamespacestd; int main () { double PI=3.141592654; coutPIendl; coutsetprecision(2) PIendl; coutfixedsetprecision(2) PIendl; coutsetfill('* ' ) setw ) setprecision ) PIendl; //一般使用setw (首先是setw )控制输出结果所占的位数,然后是结果coutsetfill('* ' ) setw 20 ) setprecision ) leftPIendl; coutscientificsetprecision(10 ) PIendl; coutscientificuppercasesetprecision (10 ) PIendl; //uppercase输出的字母为大写的return 0; (输出结果为3.141592654 ) 3.14 * * * * * 3.1415926540 * * * 3.1415926540 e 000.1415926540 e 000 fixed运算符和最重要的是浮点数的http://www.) 不是要显示的有效位数的总和。