hamming code c++ code example
Example: hamming c++
int hamming(string a, string b) {
int d = 0;
for (int i = 0; i < k; i++) {
if (a[i] != b[i]) d++;
}
return d;//hamming distance between 2 strings a and b
}
int hamming(string a, string b) {
int d = 0;
for (int i = 0; i < k; i++) {
if (a[i] != b[i]) d++;
}
return d;//hamming distance between 2 strings a and b
}