Question: I already have more than half portion of the code below. I need 1. a complete (need to add menu, correct last line in current

I already have more than half portion of the code below. I need

1. a complete (need to add menu, correct last line in current output........ etc) working code including these test when

A. user chooses even parity transmission.

B. user chooses odd parity transmission.

2. a flowchart

Develop a set of functions using C++ that would implement the HAMMING CODE.

I already have more than half portion of the code below. I

//////////////////////// // hamming code

#include #include using namespace std;

// funtion prototypes void generator(int a[11]); void display(int a[], int size); void populate(int a[11], int b[15]); void onepos(int despos[15], int hamming[15]); void binconverter(int decpos[15], int binpos[15][4]); void display2(int a[15][4]); void parity(int binpos[15][4]);

int main() { // declaration int randdata[11]; int hamming[15]; int decpos[15]; int binpos[15][4] = { 0 }; // 4 columns becuase 15 (1111)

generator(randdata); display(randdata, 11); populate(randdata, hamming); display(hamming, 15); onepos(decpos, hamming); display(decpos, 15); binconverter(decpos, binpos); display2(binpos); parity(binpos); display2(binpos); return 0; }

void generator(int a[11]) { srand(time(NULL));// new seed everytime for (int i = 0; i

////////////////////////////////////////////////////// // function that display a 1D array void display(int a[], int size) { for (int i = 0; i

void populate(int a[11], int b[15]) { int j = 0; for (int i = 0; i

if (i == 0 || i == 1 || i == 3 || i == 7) { b[i] = 2; // for check bits } else { b[i] = a[j]; j++; } } }

void onepos(int decpos[15], int hamming[15]) { int j = 0; for (int i = 0; i

void binconverter(int decpos[15], int binpos[15][4]) { int j = 3; int temp; // temp holder for (int i = 0; i0) // conversion to binay starts with LSB { if (temp % 2 == 1) { binpos[i][j] = 1; j--; // j decrement going from LSB to MSB } else { binpos[i][j] = 0; j--; } temp = temp / 2; // integer division is an integer } j = 3; } }

void display2(int a[15][4]) { // the loop will visit all the rows of the array for (int rows = 0; rows

// the child loop will visit every col for (int col = 0; col

void parity(int binpos[15][4]) { int holder = 0; for (int i = 0; i SUGGESTED FUNCTIONS PLAN: MENU To display the user options. RAW DATA GENERATER To generate a random data using C rand0...etc. HAMMING PACK AGER Prepare the hamming package using data collected... etc. PARITY DECIMAL COLLECTOR. Function to collect the addresses of the parity bits (check bits)... etc PARITY BINARY CONVERTER Function to convert the parity addresses from decimal to binary... etc. CHANNEL FUNCTION Function to create noise and flips on of the bits in the hamming package etc. DETECTOR FUNCTION Function that detects the bit that a in error ...etc. DISPLAY Display the result etc

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!