/******************************
* 10進制轉換為2進制輸出 *
******************************/
#include <iostream>
using namespace std;
void convert(int);
int main(void) {
int data;
cout << "請輸入你要轉換的數: ";
cin >> data;
convert(data);
return 0;
}
/**函數*/
void convert(int fdata) {
int c[12] = {0}, count;
count = 0;
for(int i = 0; fdata > 0; i++){
c[i] = fdata%2;
fdata = fdata/2;
count++;
}
for(int j = count; j > 0; j--) {
cout << c[j-1];
}
cout << endl;
}