十进制转换为二进制
#include <iostream>
using namespace std;
int main()
{
int a[10] = {0};
int n = 2022, count = 0;
while (n)
{
a[count ++] = n % 2;
n /= 2;
}
for (int i = count - 1; i >= 0; i --) cout << a[i];
cout << endl;
for (int i = 31; i >= 0; i --)
{
cout << (2022 >> i & 1);
}
}