In some games the character equipment is fairly basic -- one either has a particular type of item equipped, or not ("a shield is equipped"). A single bit is enough to hold this information, but memory is allocated and accessed in larger chunks. A single character, 1 byte in size, holds enough space for any configuration of 8 such binary equips (8 bits in a 1 byte).
The input file DATA1.txt will contain 5 lines, each an integer 0 <= EQUIPPED <= 255, single space delimiter, and an integer 0 <= ITEM <= 7. ITEM is the position of the bit, where 0 is the least significant bit and 7 is the most significant bit
The output file OUT1.txt will contain 5 lines of output, corresponding to each case of input. 1 if the item is present, 0 if item is not.
Reminder of how binary digits work: it's all sums of powers of 2.
255 = 27 + 26 + 25 + 24 + 23 + 22 + 21 + 20 = 11111111
Where ITEM 7 is represented by 27; and ITEM 0 together with ITEM 1 are 20 + 21 = 00000011 = 3
0 0 1 0 1 1 2 1 255 7
0 1 0 1 1