Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

有個問題想問C++

0 views
Skip to first unread message

My baby, my girl...

unread,
Feb 6, 2004, 5:33:45 AM2/6/04
to
※ 引述《airfe...@redbbs.cc.ntut.edu.tw (幻想的天空)》之銘言:
> 像c++ 可以將字元轉換成16進制與十進制
> 但是要怎麼樣轉換成二進位呢
> 如16進位--字元 --a
> cout<<hex<<static_cast<int>(a)
> 十進位
> cout<<dec<<static_cast<int>(a)
> 二進位
> ????

for(unsigned char i=1<<7; i; i>>=1)
cout<<( i & a ? 1 : 0);

--
[1;31m @ [32m, [1;37m● [1;33;41m秘密情人 [1;37;40m● [0m [1;36m(bbs.cse.ttu.edu.tw) [0m
[1;32m~\ [0m [1;34m◆ [1;37mPost From: [1;35m61-230-75-185.HINET-IP.hinet.net [0m [1;34m◆
[0m

0 new messages