看板 NTUE-CS100 關於我們 聯絡資訊
最近再找十進位轉二進位的C函式 (因為懶得自己寫了:P) 上網google出來 好幾個都寫的不怎樣 或是不合需求 結果找到一個範例看來很不錯 又精簡 我就先加入我的最愛 結果才發現網址是 http://chchwy.blogspot.com/2007/11/blog-post_24.html 挖 建中哥網誌耶!!!! 建中哥大大好威阿 >////////< PS.不過後來用了彥廷建議的 bitset函式這個更短 XDDD #include <bitset> int main() { double n = 923876533; bitset<sizeof(n) * 8> s(n); cout << n << " = " << s << endl; } -- ╔══╗ ║資科║ ║王朝║ ╚══╝ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 203.68.15.217 ※ 編輯: cair 來自: 203.68.15.217 (09/11 23:30)
tsj20719:推建中哥超威 09/11 23:37
nash3629:資科臥虎藏龍 09/11 23:37
YangSanta: 神人建中哥 09/11 23:41
linjrming:我想問一下 s是什麼型態? 09/11 23:46
daimiku: 有神快拜 09/11 23:57
chchwy:應該就是bitset吧 Generic寫法 09/11 23:57
yantchen:http://www.sgi.com/tech/stl/bitset.html 09/12 00:12