设置以上这些属性均有两种写法 一种是调用cout的方法 暂且叫做方法写法
一种是用到iomanip的函数 叫做控制器写法
一、精度 控制器写法: cout << setprecision(5); cout << fixed; 方法写法: cout.precision(5); cout.setf(ios::fixed); 二、宽度 控制器写法: cout << setw(8); 方法写法: cout.width(8); 三、进制 控制器写法: cout << hex; cout << dec; cout << oct; 方法写法: cout.setf(ios::hex); cout.setf(ios::dec); cout.setf(ios::oct);