Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdbool.h>
- char vchar()
- {
- char cc;
- while ((cc = getchar()) <= ' ');
- return cc;
- }
- int main()
- {
- unsigned long long x , maska=0x8000000000000000;
- bool dalej = true;
- char opcja;
- int i = 63,j=0;
- while (dalej)
- {
- printf("Podaj opcje: ");
- opcja = vchar();
- switch (opcja & 0x5F)
- {
- case 'N': scanf("%llu", &x); break;
- case 'L':
- {
- while (i > 0)
- {
- if ((x & maska) !=0)
- {
- printf("%d\n", i);
- break;
- }
- x <<= 1;
- i--;
- }
- break;
- }
- case 'R':
- {
- while (j<63)
- {
- if ((x & 1) == 0)
- {
- printf("%d \n", j);
- break;
- }
- x >>= 1;
- j++;
- }
- break;
- }
- case 'Q': return 0; break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement