I have two different length c++ strings.
string str1 = "01001110 01100001 01101101 01100101"
string str2 = "00000000 00000000 00000011"
I need to xor str1 and str2 and store the result in a new string
string xor_string = str1 ^ str2
So, is it possible to xor two different length strings, and to store it into another string ?
I have searched for it but I didn't get it.
Can anyone tell me, how to do it?
xoroperation is not defined on strings (because they usually contain other characters than just zeros and ones), you will have to define it yourself.^operator however you want to (see operator overloading). What type of behavior are you looking for when the lengths of the strings are unequal?xor_stringto be?