xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 3KB
    文件類型: .cpp
    金幣: 1
    下載: 0 次
    發布日期: 2021-06-14
  • 語言: C/C++
  • 標簽: 7.4漢明碼??

資源簡介

實現編碼課程中經典編碼7.4漢明碼的代碼實現

資源截圖

代碼片段和文件信息

//7.4漢明碼編解碼
#include
#include
using?namespace?std;
//編碼函數
void?bm()
{
int?t=0xa[3]b[6]tempy=0;
????int?G[4][7]={{1101000}{0110100}{1110010}{1010001}};//說明生成矩陣
????cout<<“編碼----請輸入4位二進制消息序列(列:1?1?1?1):“<????while(t<4)
{?
cin>>x;
????if(x!=0&&x!=1)
{
cout<<“輸入序列錯誤,請重新輸入:“< t=0;
continue;
}
else
{
a[t]=x;
t++;
}
}//此循環消息輸入

for(int?i=0;i<7;i++)
{
temp=0;
for(int?j=0;j<4;j++)
temp+=a[j]*G[j][i];
if(temp%2==0)
b[i]=0;
else?
b[i]=1;
}//與生成矩陣相乘,生成碼字

cout<<“編碼后的碼字:“;
while(y<7)
{
cout< y++;
}
cout<}



//譯碼函數

void?ym()
{?
??int?t=0b[7]s[3]e[7]tempxy=0m=3r=0;
??int?H[7][3]={{100}{010}{001}{110}{011}{111}{101}};//校驗矩陣
??cout<<“譯碼----請輸入7位二進制碼字序列(列:1?1?1?1?1?1?1?):“<??while(t<7)
??{?
????cin>>x;
if(x!=0&&x!=1)
{
???????cout<<“輸入序列錯誤,請重新輸入:“< ???t=0;
???????continue;
}
????else
{
???b[t]=x;
???t++;
?}
??}//此循環是序列輸入
????for(int?i=0;i<3;i++)
{
??????temp=0;
??for(int?j=0;j<7;j++)
??temp+=b[j]*H[j][i];
??????if(temp%2==0)
????s[i]=0;
??else?
s[i]=1;
}//此循環計算校正子

e[0]=s[0]&(!s[1])&(!s[2]);//計算差錯位
????e[1]=(!s[0])&s[1]&(!s[2])

評論

共有 條評論

相關資源