You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
454 B
23 lines
454 B
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
int main() {
|
|
int a = 10, b = 20;
|
|
|
|
cout << "a<<8=" << (a << 8) << endl;
|
|
int x = 2560;
|
|
// 101000000000
|
|
vector<int> q;
|
|
while (x) {
|
|
q.push_back(x % 2);
|
|
x /= 2;
|
|
}
|
|
for (int i = q.size() - 1; i >= 0; i--) cout << q[i];
|
|
cout << endl;
|
|
|
|
a = (a << 8) | b;
|
|
|
|
b = a >> 8;
|
|
a = a & 0xff;
|
|
cout << a << " " << b << endl;
|
|
return 0;
|
|
} |