Hamming code help

1 )Determine if there’s an incorrect bit, and if so, where it is.

2) Display CORRECT code

3) Display the decimal form of the message that was sent, after any needed correction. Remember, when using Hamming code, only the 3, 5, 6, and 7 slots comprise the actual message!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42


#include<iostream> 
using namespace std;
int hammingError(int a1, int a2, int a3, int a4, int a5, int a6, int a7);
int BinarytoDecimal(int a1, int a2, int a3, int a4, int a5, int a6, int a7);


int main(){
int dataA[] = { 1, 1, 0, 1, 0, 1, 0 };
int dataB[] = { 0, 0, 1, 0, 1, 1, 1 };
int dataC[] = { 1, 0, 1, 0, 1, 0, 1 };
int dataD[] = { 1, 0, 0, 1, 0, 0, 1 };
int dataE[] = { 0, 1, 1, 0, 0, 1, 1 };
'
'
'
'
'//completed #1
'

return 0;
}
int hammingError(int a1, int a2, int a3, int a4, int a5, int a6, int a7){
'
'
'
'
'' //completed#2

'

return error_location;
}
int BinarytoDecimal(int a1, int a2, int a3, int a4, int a5, int a6, int a7){
int array[3] = { a3, a5, a6, a7 };
int decimal = 0;
array[3]= (a3 * 8)+ ( a5 * 4 )+ (a6 * 2) +( a7 * 1);  ///?
cout << "the decimal is:" << array[3] << endl;
return decimal;
}
 
Last edited on
Topic archived. No new replies allowed.