[問題] Re: 如何換成十進位呢

看板C_and_CPP作者 (骨傲風清(掛網))時間13年前 (2012/07/05 00:29), 編輯推噓0(003)
留言3則, 3人參與, 最新討論串1/1
假設你二進位存在陣列 two 中 int ten = 0; for(int k = 0; k < n; k++) { ten = ten*2 + two[k]; } ※ 引述《derange99 (derange)》之銘言: : CPP : 請問輸入一二進位的數(ex:10010),要怎麼將他換成十進位? : (Use the modulus and division operators to pick off the binary number's : digits one at a time from right to the left) : 因為才剛學cpp,所以能用簡單的方法最好 : 感激不盡 -- -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 180.217.21.138

07/05 13:53, , 1F
這種作業文就不用給了
07/05 13:53, 1F

07/05 16:33, , 2F
他至少還要處理把輸入塞進陣列這件事 XD
07/05 16:33, 2F

07/05 17:04, , 3F
還有溢位問題喔~
07/05 17:04, 3F
文章代碼(AID): #1Fz6zKda (C_and_CPP)