how to perform XOR operation on a string of zeroes and ones that are in arrays

  c++

I have arrays of zeroes and ones and I want to perform XOR operation between the arrays. the XOR operation would be performed on every 4 positions individually, so position 0 until position 3 will form a 4-bit block, and position 4 until 7 will form a 4-bit block

Example:

disk[0] has 1010 0011

disk[1] has 1010 0000

disk[2] has 1111 0000

disk[3] has 0011 0000

my desired output would be

disk[4] = 1100 0011

i am thinking of using .substr(pos, length) where the position will be the same for 4 disks and the length will be 1 and then i will count the number of 1s and check if it’s even or odd to do the parity check.

Source: Windows Questions C++

LEAVE A COMMENT