#include <iostream>
#include <bitset>
using std::cout;
using std::endl;
int main(int argc,char *argv[],char *envp[])
{
cout<<"binary: "<<std::bitset<8>(16)<<endl;//输出八位二进制数16, 00010000
cout<<std::showbase<<std::oct<<"octal: "<<16<<endl;// 020
cout<<std::showbase<<std::dec<<"decimal: "<<16<<endl;// 16
cout<<std::showbase<<std::hex<<"hexdecimal: "<<16<<endl;// 0x10
return 0;
}
来源:CSDN
作者:zing2000
链接:https://blog.csdn.net/zing2008/article/details/104393432