Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #define BITS 8
- using namespace std;
- int main(){
- int M = 0;
- int bits[BITS] = {};
- cout << "Введите M" << endl;
- cin >> M;
- M += 1;
- for( int i = 0; i < BITS; i++ )
- bits[BITS-i-1] = ( M & ( 1 << i ) ) != 0;
- cout << "биты M + 1" << endl;
- for( int i = 0; i < BITS; i++ )
- cout << bits[i];
- cout <<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement