kal*_*kal 0 c++ printing bit
如何打印字符串的位表示
std::string = "\x80"; void print (std::string &s) { //How to implement this }
Joh*_*itb 6
我投票支持bitset:
bitset
void pbits(std::string const& s) { for(std::size_t i=0; i<s.size(); i++) std::cout << std::bitset<CHAR_BIT>(s[i]) << " "; } int main() { pbits("\x80\x70"); }
归档时间:
17 年,2 月 前
查看次数:
2989 次
最近记录:
12 年,6 月 前