Need help ASAP in Hamming Code program!! C++ You need to write a program which,
ID: 3564941 • Letter: N
Question
Need help ASAP in Hamming Code program!! C++
You need to write a program which, given a seven digit binary input (which I will provide), it will check to see if there is a single bit error using the Hamming Code method discussed in class. Remember, Hamming Code has three check bits, located at 1, 2, and 4. For a sample of Hamming Code, the input from Homework 3: 1011001 will reveal that '001' is the location of the error (meaning the first slot in the number), so the corrected number would be 0011001, and the actual message transmitted (minus the check bits), would be 1001, which is 9 in decimal. You can use this example to test your program to ensure it's working correctly. FOR YOUR ASSIGNMENT: Create a program which can, given a 7-bit long input, written in Hamming Code style, do the three following tasks, displaying the results as output. 1) Determine if there's an incorrect bit, and if so, where it is. 2) Display what the CORRECT code should look like (if it needs to be corrected.) 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! For your input, use the following five inputs, and show the results of each: 1.) 1101010 2.) 0010111 3.) 1010101 4.) 1001001 5.) 0110011 Please don't forget that you can use the sample of Hamming Code provided to test your code for correctness.Explanation / Answer
#include #include void main() { int data[7],rec[7],i,c1,c2,c3,c; printf("this works for message of 4bits in size enter message bit one by one: "); scanf("%d%d%d%d",&data[0],&data[1],&data[2],&data[4]); data[6]=data[0]^data[2]^data[4]; data[5]=data[0]^data[1]^data[4]; data[3]=data[0]^data[1]^data[2]; printf(" the encoded bits are given below: "); for (i=0;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.