cpp_manipulator

来源:互联网 发布:淘宝pc详情页尺寸多少 编辑:程序博客网 时间:2024/06/03 12:30
//Date 2013/1/22//test for 19 manipulator//dec, endl, fixed, hex, oct, left, right//scientific, setfill(c), setprecision(n), setw(n)//showpoint, showpos#include <iostream>#include <iomanip>using namespace std;int main(){int num = 5201314;double dn = 5.201314;cout << "num: " << num << endl;cout << "dec: " << dec << num << endl;cout << "oct: " << oct << num << endl;cout << "hex: " << hex << num << endl;cout << "dn : " << dec << num << endl;cout << setw(20) << fixed << dn << endl;cout << setw(20) << scientific << dn << endl;cout << setw(20) << left << showpoint << showpos << dn << endl;cout << setw(20) << setprecision( 2 ) << setfill('*') << dn << endl;return 0;}

原创粉丝点击