- DP -
2010-09-12 18:48:13 UTC
The assignment is to create a program that takes in two strings and finds the Hamming distance (the number of bit positions where the two strings differ). For example, if I were to compare the strings:
"f" = 0110 0110
and
"a" = 0110 1111
the hamming distance would be 2.
The part I've accomplished so far is storing the strings into variables. However, I'm confused as to how I will convert the characters into ASCII bits for comparison. I also don't know how I'm supposed to go about storing the counter for the comparisons (I know there will be a loop used).
A few specifications for the program include:
if the user uses two strings with different lengths, the distance up to the length of the shorter string should be returned.
The maximum length of a string can be 255 characters.
Please help!
Thank you!