Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a C++ program to add either even or odd parity, no parity as default, to a byte. Next randomly flip one bit and detect
Create a C++ program to add either even or odd parity, no parity as default, to a byte. Next randomly flip one bit and detect that there is an parity error and report. Submit source code.
Algorithm to create and add parity bit:
integer array[8]
integer even = 0, odd = 0; integer bitcount=0;
for (intgere i=0; i <6; i++) { if (array[i] == 1) { increment bitcount } }
if (bitcount modulus 2 equal zero){ even = 0 odd = 1 } else { even = 1 odd = 0 }
if (parityType is even) array[7] = even else if (parityType is odd) array[7] = odd
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started