资源简介
该程序已经验证通过,实验结果正确。包括编码和解码两部分,并且能够校正错误
代码片段和文件信息
#include
#include
void power2bin (int int [] int *);
void hex2bin (char [] int []);
void encoder (int [][5] int [] int []);
void channel (int []);
int decoder (int [][5] int []);
void main ()
{
int array_a[5] = {0 0 0 0 0};
int array_b[4] = {0 1 0 1};
int array_G [10][5] = {
1 1 0 1 0
0 1 1 0 1
1 1 1 0 0
0 1 1 1 0
0 0 1 1 1
1 1 0 0 1
1 0 1 1 0
0 1 0 1 1
1 1 1 1 1
1 0 1 0 1
}; /*生成矩阵*/
int array_transpose_H [15][5] ={1 1 0 1 0
0 1 1 0 1
1 1 1 0 0
0 1 1 1 0
0 0 1 1 1
1 1 0 0 1
1 0 1 1 0
0 1 0 1 1
1 1 1 1 1
1 0 1 0 1
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
};/*一致校验矩阵*/
int array_code [15] = {0};
int array_receive [15] = {0};
char array_input_char[3] = {0};/*输入三个16进制字符*/
int array_input[10] = {0}; /*将16进制字符转换为二进制*/
int counter_0 = 0 counter_1 = 0;
int mark = 0;
printf (“本程序对输入的数据是否在允许的范围内没有进行检验\n“);
printf (“当得出的结果错误时可能是输入的数据超出了允许的范围.\n“);
printf (“十六进制输入时用小写a-f.\n\n“);
printf (“输入数据(0-3ffh):“);
gets(array_input_char);
/*将16进制转换为2进制数*/
hex2bin (array_input_char array_input);
/*显示2进制信息序列*/
printf (“\n\n编码前的二进制信息序列为(MSB-->LSB): “);
for (counter_0 = 0; counter_0 <= 10 - 1; counter_0++)
{
printf (“%d “ array_input [9 - counter_0]);
array_code [counter_0] = array_input [counter_0];
}
/*编码过程*/
encoder (array_G array_code array_input);
/*打印出编码后的信息序列*/
printf (“\n\n经2/3FEC编码后的二进制信息序列为(MSB-->LSB): “);
for (counter_0 = 0; counter_0 <= 5 - 1; counter_0++)
{
printf (“%d “ array_code [14 - counter_0]);
array_receive [counter_0] = array_code [counter_0];
}
printf (“ “);
for (counter_0 = 5; counter_0 <= 15 - 1; counter_0++)
{
printf (“%d “ array_code [14 - counter_0]);
array_receive [counter_0] = array_code [counter_0];
}
/*信息序列通过信道*/
channel (array_receive);
printf (“\n经信道传输后接收的序列为: “);
for (counter_0 = 0; counter_0 <= 5 - 1; counter_0++)
{
printf (“%d “ array_receive [14 - counter_0]);
}
printf (“ “);
for (counter_0 = 5; counter_0 <= 15 - 1; counter_0++)
{
printf (“%d “ array_receive [14 - counter_0]);
}
/*译码过程*/
mark = decoder (array_transpose_H array_receive);
printf (“\n“);
if (mark == -1)
{
printf (“超出纠错范围 不可纠错! 译码结果为: “);
}
else if (mark == -2)
{
printf (“信道传输正确或产生不可检错的误码序列!译码结果为: “);
}
else
{
array_receive [mark] = (array_receive [mark] + 1) % 2;
printf (“信道传输产生1位错码!可纠错!该码位于第 %d 位,译码结果为: “ 15 - mark);
}
for (counter_0 = 0; counter_0 <= 10 - 1; counter_0++)
{
printf (“%d “ ar
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7646 2009-10-30 23:28 FEC\FEC.c
文件 3363 2007-11-25 15:28 FEC\FEC.dsp
文件 531 2007-11-25 16:17 FEC\FEC.dsw
文件 50176 2009-10-29 16:39 FEC\FEC.ncb
文件 721 2009-10-29 16:36 FEC\FEC.plg
文件 48640 2009-10-29 16:39 FEC\FEC.opt
文件 168014 2009-10-29 16:36 FEC\Debug\FEC.exe
文件 177836 2009-10-29 16:36 FEC\Debug\FEC.ilk
文件 14698 2009-10-29 16:36 FEC\Debug\FEC.obj
文件 427008 2009-10-29 16:36 FEC\Debug\FEC.pdb
文件 33792 2009-10-29 16:38 FEC\Debug\vc60.idb
文件 45056 2009-10-29 16:36 FEC\Debug\vc60.pdb
文件 184772 2009-10-29 16:36 FEC\Debug\FEC.pch
文件 43520 2009-10-29 16:38 FEC\Debug\FEC.opt
目录 0 2009-10-29 17:18 FEC\Debug
目录 0 2009-10-29 17:18 FEC
----------- --------- ---------- ----- ----
1205773 16
- 上一篇:20-sim介绍
- 下一篇:号称最漂亮的编程字体Inconsolata.ttf
相关资源
- 一个类似定时番茄钟的app源码
- Pixel Perfect Camera 1.42
- ImageEffect_BrokenScreen
- Effective+STL+中文版chm版非常清晰
-
EffectPla
yer2.0.rar -
EffectPla
yer.rar - LegacyImageEffects资源包.rar
- 情感计算 Affective Computing 经典论文
- HP Application Lifecycle Management 11.50 + SP
- Biotransformation of selenium by seaweed Graci
- Effects of PCE pollution on soil enzyme activi
- Dissipation of carbendazim and chloramphenicol
- Effect of photocatalysis on Fischer-Tropsch sy
- Normal Stress Effects in Slider-Disk Interface
- The Effects of Exogenous H2O2 and AsA on Occur
- Inhibitory Effect on Monoamine oxidase of Lact
- Synergistic effect of surfactants on the stabi
- The effects of fast neutron irradiation on oxy
-
Size Effects for the Adsorption of Alkali me
- Effect of tribocorrosion processes on adsorpti
- Microdefects in heavily phosphorus-doped Czoch
- Effects of Alprostadil on reducing plasmas D-d
- Effect of K Fertilization on Soil K Pools and
- Isolation and Identification of Glycopeptides
- As-grown defects in highly phosphorus-doped Cz
- Effect of conjunctival extracellular matrix on
- Investigation of Quenching Rail White Line la<
- Defects of Navier-Stokes Equations and a New E
- Toshio Mura.Micromechanics of Defects in Solid
- Effect of ADH1B Arg48His polymorphism on DNA d
评论
共有 条评论