是否有 printf 转换器以二进制格式打印? - Is there a printf converter to print in binary format?

问题:

I can print with printf as a hex or octal number.我可以用printf打印为十六进制或八进制数。 Is there a format tag to print as binary, or arbitrary base?是否有以二进制或任意基数打印的格式标签?

I am running gcc.我正在运行 gcc。

printf("%d %x %o\n", 10, 10, 10); //prints "10 A 12\n"
print("%b\n", 10); // prints "%b\n"

解决方案:

参考一: https://en.stackoom.com/question/T7I
参考二: https://stackoom.com/question/T7I
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章