输出10进制数的二进制表示

#include<bitset>

int a = 888;
cout << bitset<sizeof(int)*8>(a) << endl;    //.to_sttring(), bitset类型转string类型

a 必须是10进制有符号数

原文地址:https://www.cnblogs.com/friedCoder/p/12245147.html