竟然刚发现直接%2/2输出的是相反的;
所以得用一个数组存起来
#include <bits/stdc++.h>
using namespace std;
int main()
{
/*for(int i=0;i<=4;i++){
int t=19;
cout << (t<<i&1);
}*/
int a[100];
int t=19,cnt=0;
while(t){
a[cnt]=t%2;
t/=2;
cnt ++;
}
for(int i=cnt-1;i>=0;i--) cout << a[i]<<" ";
}