关于C++的输出流cout格式化输出

来源:互联网 发布:广州专利代理待遇知乎 编辑:程序博客网 时间:2024/06/05 11:33

例子:

 

//More streams features

 

#include <iostream>

using namespace std

 

int main()

{

    cout << "a number in decimal:" << dec << 15 << endl;

    cout << "in octal:" << oct << 15 << endl;

    cout << "in hex:" << hex << 15 << endl;

    cout << "a floating-point number:" << 3.14159 << endl;

    cout << "non-printing char (escape):" << char(27) << endl;

}

原创粉丝点击