[問題] binary representation
C++裡面有提供10進制轉16進制等的方法如下
但是,不曉得有沒有十進制轉二進制的表示方法? 可以像下面這樣簡單
謝謝!!
#include <iostream>
using namespace std;
int main () {
int n;
n=70;
cout << hex << n << endl;
cout << dec << n << endl;
cout << oct << n << endl;
system("pause");
return 0;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.41.65
→
04/01 23:11, , 1F
04/01 23:11, 1F
推
04/02 13:40, , 2F
04/02 13:40, 2F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章