码迷,mamicode.com
首页 > 其他好文 > 详细

5.cout控制格式

时间:2019-03-04 19:26:32      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:Nging   get   ber   end   格式   int   col   使用   hex   

使用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控制格式

标签:Nging   get   ber   end   格式   int   col   使用   hex   

原文地址:https://www.cnblogs.com/foremember/p/10472240.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!