Question: Can you give me the actual c + + code using this as a starter code? #include #include #include using namespace std; const string ID

Can you give me the actual c++ code using this as a starter code?
#include
#include
#include
using namespace std;
const string ID = "Stellar Carroll - CS 1337- Lab 31
";
int main()
{
short HammingChar;
uint bit1, bit2, bit4, bit8, offendingBit;
char ch;
// output ID Line
cout ID;
// read an unknown # of short ints, each representing a Hamming character
while (cin >> HammingChar)
{
offendingBit =0;
// Use the formula to calculate parity bit 1
bit1=(getBit(HammingChar,11-3)+
getBit(HammingChar,11-5)+
getBit(HammingChar,11-7)+
getBit(HammingChar,11-9)+
getBit(HammingChar,11-11))%2;
// Use the formulas to calculate parity bits 2,4, and 8
bit2=(getBit(HammingChar,11-3)+
getBit(HammingChar,11-6)+
getBit(HammingChar,11-7)+
getBit(HammingChar,11-10)+
getBit(HammingChar,11-11))%2;
bit4=(getBit(HammingChar,11-5)+
getBit(HammingChar,11-6)+
getBit(HammingChar,11-7))%2;
bit8=(getBit(HammingChar,11-9)+
getBit(HammingChar,11-10)+
getBit(HammingChar,11-11))%2;
// Now compare the calculated bit 1 to the value from the HammingChar
if (bit1!= getBit(HammingChar,11-1))
offendingBit +=1;
// do similarly for bits 2,4, and 8
if (bit2!= getBit(HammingChar,11-1))
offendingBit +=1;
if (bit4!= getBit(HammingChar,11-1))
offendingBit +=1;
if (bit8!= getBit(HammingChar,11-1))
offendingBit +=1;
cout "Debug: offendingBit =" offendingBit endl;
// if offendingBit !=0 then
// intvert (11- offendingBit)
// Build ch from HammingChar
ch = setBit(ch,7,0); //initialize the high bit of ch to 0
// cout ch;
}
return 0;
}
 Can you give me the actual c++ code using this as

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!