Assignment 4
Assignment 4
Div: SY B Comp
Roll no.:13
Sub: Data Communication & Networking Lab
Assignment 4
Problem statement: Write a program for error detection and correction for 7/8 bits ASCII codes
using Hamming Codes or CRC. Demonstrate the packets captured traces using Wireshark
Packet Analyzer Tool for peer to peer mode.
Code:
int main()
{ int n = 7;
int arr[n]; int
p1, p2, p4; int
choice;
cout << "Choose an option:\n1. Generate Hamming Code\n2. Detect Error in Received
Data\nEnter your choice: "; cin >> choice;
switch (choice) {
case 1:
// Encoding Hamming Code cout <<
"Enter the data bits (D3, D5, D6, D7): "; cin >>
arr[2] >> arr[4] >> arr[5] >> arr[6];
default:
cout << "Invalid choice!" << endl;
break;
}
return 0;
}