Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void set(char arr[], int i, bool v)
- {
- char temp = arr[i / 8];
- char pos = 1 << (i % 8);
- printf("%d", pos);
- if (v)
- {
- temp = temp | pos;
- }
- else
- {
- pos = ~pos;
- temp = temp&pos;
- }
- arr[i / 8] = temp;
- }
- bool get(char arr[], int i)
- {
- char pos = 1 << (i % 8);
- return arr[i / 8] & pos;
- }
- void kolos1()
- {
- char arr[10];
- set(arr, 10, true);
- set(arr, 11, true);
- for (int i = 0; i < 80; i++)
- {
- printf("%c",get(arr,i)?'+':'-');
- }
- puts("");
- set(arr, 10, false);
- for (int i = 0; i < 80; i++)
- {
- printf("%c", get(arr, i) ? '+' : '-');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement