5.cout控制格式

Posted foremember

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了5.cout控制格式相关的知识,希望对你有一定的参考价值。

使用hex和oct以上述三种格式显示十进制值42。默认格式为十进制,在修改格式之前,原来的格式将一直有效

void hexoct2(void)
{
    int chest=42;
    int waist=42;
    int inseam=42;
 
    cout<<"monsieur cuts a striking figure!"<<endl;
    cout<<"chest="<<chest<<" (decimal for 42)"<<endl;
    cout<<hex;//manipulator for changing number base
    cout<<"waist="<<waist<<" (hexadecimal for 42)"<<endl;
    cout<<oct;//manipulator for changing number base
    cout<<"inseam="<<inseam<<" (octal for 42)"<<endl;
 
    cin.get();
}

 

以上是关于5.cout控制格式的主要内容,如果未能解决你的问题,请参考以下文章

为 Blogger 上的博客格式化代码片段 [关闭]

片段中的媒体控制器

Laravel:如何在控制器的几种方法中重用代码片段

postman添加断言

SQLite 片段函数实现不会在 TextView 中将文本格式化为 HTML

全栈编程系列SpringBoot整合Shiro(含KickoutSessionControlFilter并发在线人数控制以及不生效问题配置启动异常No SecurityManager...)(代码片段