Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #define N 4
- typedef struct el {
- int inf; char name[15]; struct el * next;
- }unit;
- int main()
- {
- unit lst[N], *lstp[N + 1];
- char p[] = "Kolumbia", x, y;
- x = 8; y = 4; printf("1: %x %x\n", x << 2, y >> 1);
- x = 0x80; y = 1; x <<= 1; y >>= 1; printf("2: %x %x\n", x, y);
- x = 0x9; printf("3:%x %x %x\n", x | 3, x & 3, x ^ 3);
- x = 0x9; printf("4:%x %x %x\n", x | 4, x & 4, x ^ 4);
- x = 1; do{ x <<= 1; printf("5:%x\n", x); } while (!(x & 0x10));
- x = 0x10; while (x){ printf("6:%x \n", x); x >>= 2; }
- for (x = 0; x<N; x++)
- {
- lst[x].inf = x + 2; lst[x].next = lst + (x + 1) % N;
- strcpy(lst[x].name, p); (*(p + x))++;
- printf("7: %s\n", lst[x].name + 1);
- lstp[x] = lst + x;
- }
- lstp[N] = lstp[0]; lstp[0] = lstp[1]; lstp[1] = lstp[N];
- for (x = 0; x<N; x++)
- {
- printf(" 9:%d %s\n", lstp[x]->inf, lstp[x]->name);
- printf("10:%d %s\n", lst[x].next->inf, lst[x].next->name);
- }
- return 0;
- }
- /*
- !!!**Answers**!!!
- 1: 20 2
- 2: 0 0
- 3: b 1 a
- 4: d 0 d
- 5: 2
- 5: 4
- 5: 8
- 5: 10
- 6: 10
- 6: 4
- 6: 1
- 7: olumbia
- 7: olumbia
- 7: plumbia
- 7: pmumbia
- 9: 3 Lolumbia
- 10: 3 Lolumbia
- 9: 2 Kolumbia
- 10: 4 Lplumbia
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement