Hamming Distance

Hi
Can anyone please help write a Hamming Distance function that compares two strings, then return the Hamming Distance between them.
just do an AND operator between the two binary numbers and then count the 1's..

shouldn't be too hard
AND will not work.
oops EXOR? :)
That doesn't work....actually I'm trying to develop a spellchecker application that make use of the Hamming distance.
It's easy. Just count the difference: http://en.wikipedia.org/wiki/Hamming_distance
I do understand the Hamming Distance but I need to create a function using c++
if you are comparing strings with the same length, you can use CompareTexts() - st1.Length, you will get a hamming distance, but i dont know about a proper way or the documented way, i just created that for myself.
You'll need to use a loop, for n in [0, length_of_shortest_string - 1], and count the number of times the characters in the strings differ.
Topic archived. No new replies allowed.