Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int utolsoBit(int n){
- return ((n>>1)<<1)^n;
- }
- //1. Feladat
- void titkosit(int n){
- n= n^1;
- n= n^1;
- cout<< n << '\n';
- }
- //2. Feladat
- void kiKetBajton(int n){
- for (int i = 0; i < 16; ++i) {
- int k= utolsoBit(n);
- cout<<k<<'\n';
- n= n>>1;
- }
- return;
- }
- //3. Feladat
- void bitrotacioPozicio(int n, int ind){
- ind++;
- int k=0;
- for (int i = 0; i <ind; ++i) {
- k=(k<<1);
- k=k | (utolsoBit(n));
- n= n>>1;
- }
- n= n<<(ind);
- n= n | k;
- cout<<n;
- }
- //4. Feladat
- int swapKetBajton(int &n){
- int ind= 16;
- int k= 0;
- for (int i = 0; i <ind; ++i) {
- k=(k<<1);
- k=k | (utolsoBit(n));
- n= n>>1;
- }
- n=k;
- cout<<n<<'\n';
- return n;
- }
- //5. Feladat
- void korbeforgatAdottPozicio(int n, int ind){
- }
- //6. Feladat
- void rekFonokok(){
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement