Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <bitset>
- using namespace std;
- int number = 114;
- void cleanFifthBit (){
- bitset<32> numberBits = number;
- cout << "Stara stoinost: " << numberBits.to_ulong() << endl;
- numberBits[4] = 0; // chistim 5tiq bit ot dqsno na lqvo.. indexite zapochvat ot 0
- cout << "Nova stoinost: " << numberBits.to_ulong() << endl;
- }
- //3ti i 4ti bit ot dqsno na lqvo da e 1ca
- void setBitCouple(){
- bitset<32> numberBits = number;
- cout << "Stara stoinost: " << numberBits.to_ulong() << endl;
- numberBits[2] = 1;
- numberBits[3] = 1;
- cout << "Nova stoinost: " << numberBits.to_ulong();
- }
- int main(){
- cleanFifthBit();
- setBitCouple();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement