Skip to content

moocf/hamming-code.cxx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Find hamming code for message bits, corrupt a single bit, and then correct the error.

Run this on: OnlineGDB


$ clang main.cxx
$ ./a.out

# Enter the message bits: 1001101
# Message length: 7 bits
# Number of parity bits: 4 bits
# Transmitted data length: 11 bits
# Transmitted bits: 10011100101
#
# Enter bit position to flip to simulate error (0-10): 8
# Received bits:    10111100101
#
# Single bit error detected at position: 8
# Corrected bits:   10011100101
# Received message: 1001101
# Received message length: 7 bits

$ clang main.cxx
$ ./a.out

# Enter the message bits: 10011100101
# Message length: 11 bits
# Number of parity bits: 4 bits
# Transmitted data length: 15 bits
# Transmitted bits: 100111000101111
#
# Enter bit position to flip to simulate error (0-14): 10
# Received bits:    100101000101111
#
# Single bit error detected at position: 10
# Corrected bits:   100111000101111
# Received message: 10011100101
# Received message length: 11 bits



ORG

About

Find hamming code for message bits, corrupt a single bit, and then correct the error.

Resources

License

Stars

Watchers

Forks

Languages