Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 11.29 KB | None | 0 0
  1. #include <bitset>
  2.  
  3. #include <cstdlib>
  4.  
  5. #include <iostream>
  6.  
  7. #include <fstream>
  8.  
  9. #include <ctime>
  10.  
  11. #include <string.h>
  12.  
  13.  
  14.  
  15. using namespace std;
  16.  
  17.  
  18.  
  19. int main(int argc, char** argv) {
  20.  
  21.      int size=100;
  22.  
  23.      int i,j,k,l,p=0,crc1=0,crc2=0,crc3=0;
  24.  
  25.         int err;
  26.  
  27.         cout<<"Please enter an error rate(1 to 100)"<<"\n";
  28.  
  29.         cin>>err;
  30.  
  31.     srand ( time(NULL) );  
  32.  
  33.        
  34.  
  35.        
  36.  
  37.       ofstream myfile ("frames.txt");
  38.  
  39.      
  40.  
  41.   if (myfile.is_open())
  42.  
  43.   {
  44.  
  45.    
  46.  
  47.    
  48.  
  49.   for ( i = 0; i < size; i++ ) {
  50.  
  51.     myfile<< bitset<8>(rand()) <<"\n";
  52.  
  53.    
  54.  
  55.           }
  56.  
  57.    
  58.  
  59.    
  60.  
  61.     myfile.close();
  62.  
  63.        }
  64.  
  65.  
  66.  
  67.   else cout << "Unable to open file";
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  //void Array::readData(string file_name) {
  74.  
  75.  
  76.  
  77.    
  78.  
  79.      bitset<8> array[size];
  80.  
  81.      bitset<9> array2[size];
  82.  
  83.      bitset<9> array3[size];
  84.  
  85.      bitset<13> array4[size];
  86.  
  87.      bitset<13> array5[size];
  88.  
  89.      bitset<13> array6[size];
  90.  
  91.      bitset<40> array8[size];
  92.  
  93.      bitset<40> array9[size];
  94.  
  95.      bitset<40> array10[size];
  96.  
  97.      bitset<15> array11[size];
  98.  
  99.      bitset<15> array12[size];
  100.  
  101.      bitset<15> array13[size];
  102.  
  103.        
  104.  
  105.     ifstream infile;
  106.  
  107.     //infile.open(file_name.c_str());
  108.  
  109.     infile.open("frames.txt");
  110.  
  111.     if (!infile) {
  112.  
  113.         cout << "Could not open "
  114.  
  115.               //  << file_name
  116.  
  117.                 << " file for reading."
  118.  
  119.                 << endl;
  120.  
  121.      
  122.  
  123.     }
  124.  
  125.  
  126.  
  127.     while (infile >> array[j]) {
  128.  
  129.         j++;
  130.  
  131.     }
  132.  
  133.    
  134.  
  135.   infile.close();
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  for(i=0;i<size;i++)
  148.  
  149.  {
  150.  
  151.      k=0;
  152.  
  153.      for(j=0;j<8;j++)
  154.  
  155.      {
  156.  
  157.          
  158.  
  159.           array2[i][j+1]=array[i][j];
  160.  
  161.          
  162.  
  163.          
  164.  
  165.                  if(array[i][j]==1){
  166.  
  167.              k++;
  168.  
  169.        
  170.  
  171.                  }
  172.  
  173.         //  cout<<k<<endl;
  174.  
  175.           if(k%2==0)
  176.  
  177.           k=0;
  178.  
  179.           array2[i][0]=k;
  180.  
  181.      }
  182.  
  183.      
  184.  
  185.     //cout<<k<<endl;   
  186.  
  187.    
  188.  
  189.          
  190.  
  191.      }
  192.  
  193.              
  194.  
  195.              
  196.  
  197. // cout<<array2[5];
  198.  
  199.  //void Array::writeData(string file_name) {
  200.  
  201.  
  202.  
  203.  
  204.  
  205.     ofstream outFile;
  206.  
  207.  
  208.  
  209.     outFile.open("frames2.txt");
  210.  
  211.  
  212.  
  213.     if (!outFile) {
  214.  
  215.         cout << "Could not open "
  216.  
  217.             // << file_name
  218.  
  219.              << " file for writing."
  220.  
  221.              << endl;
  222.  
  223.        
  224.  
  225.     }
  226.  
  227.  
  228.  
  229.     for (i = 0; i < size; i++) {
  230.  
  231.         outFile << array2[i];
  232.  
  233.         outFile << endl;
  234.  
  235.     }
  236.  
  237.  
  238.  
  239.     outFile.close();
  240.  
  241.  
  242.  
  243.  
  244.  
  245. //cout <<array[0]<< endl;
  246.  
  247.  
  248.  
  249.  int arr[size];
  250.  
  251.  for(i=0;i<err;i++)
  252.  
  253.  {
  254.  
  255.      arr[i]=rand() % size;
  256.  
  257.     for(k=0;k<i-1;k++){
  258.  
  259.     while(arr[k]==arr[i]){
  260.  
  261.         arr[i]=rand() % size;
  262.  
  263.      }
  264.  
  265.  }
  266.  
  267.  }
  268.  
  269.  //cout<<arr[0]<<arr[1]<<arr[2]<<arr[3]<<endl;
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  for(i=0;i<err;i++){
  276.  
  277.      //srand ( time(NULL) );
  278.  
  279.    j = arr[i];
  280.  
  281.    
  282.  
  283. array[j]=bitset<8>(rand());
  284.  
  285. cout<<array[j]<<endl;
  286.  
  287. cout<<array2[j]<<endl;
  288.  
  289. cout<<j<<endl;
  290.  
  291. }
  292.  
  293. // cout<<array[5]<<endl;
  294.  
  295. //cout<<array2[5]<<endl;
  296.  
  297.  
  298.  
  299.  for(i=0;i<size;i++)
  300.  
  301.  {
  302.  
  303.      k=0;
  304.  
  305.      for(j=0;j<8;j++)
  306.  
  307.      {
  308.  
  309.          
  310.  
  311.           array3[i][j+1]=array[i][j];
  312.  
  313.          
  314.  
  315.          
  316.  
  317.                  if(array[i][j]==1){
  318.  
  319.              k++;
  320.  
  321.        
  322.  
  323.                  }
  324.  
  325.     //    cout<<k<<endl;
  326.  
  327.           if(k%2==0)
  328.  
  329.           k=0;
  330.  
  331.           array3[i][0]=k;
  332.  
  333.          
  334.  
  335.        
  336.  
  337.          
  338.  
  339.      }
  340.  
  341.      
  342.  
  343.     //cout<<k<<endl;   
  344.  
  345.     if(array2[i][0]!=array3[i][0])
  346.  
  347.           p=p+1;   
  348.  
  349.          
  350.  
  351.      }
  352.  
  353.      
  354.  
  355.              
  356.  
  357.  //cout<<array2[5]<<endl;
  358.  
  359.  //void Array::writeData(string file_name) {
  360.  
  361.  
  362.  
  363.  
  364.  
  365.     ofstream outFile2;
  366.  
  367.  
  368.  
  369.     outFile2.open("frames3.txt");
  370.  
  371.  
  372.  
  373.     if (!outFile2) {
  374.  
  375.         cout << "Could not open "
  376.  
  377.             // << file_name
  378.  
  379.              << " file for writing."
  380.  
  381.              << endl;
  382.  
  383.        
  384.  
  385.     }
  386.  
  387.  
  388.  
  389.     for (i = 0; i < size; i++) {
  390.  
  391.         outFile2 << array3[i];
  392.  
  393.         outFile2 << endl;
  394.  
  395.     }
  396.  
  397.  
  398.  
  399.     outFile2.close();
  400.  
  401.  
  402.  
  403. cout<<err<<endl;
  404.  
  405. cout<<p<<endl;
  406.  
  407. cout<<"Error detection rate for parity check is "<<size*p/err<<" %."<<endl;
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415. //For CRC 1   x^5+1
  416.  
  417.  
  418.  
  419.  for(i=0;i<size;i++)
  420.  
  421.  {
  422.  
  423.      
  424.  
  425.      for(j=0;j<8;j++)
  426.  
  427.      {
  428.  
  429.          
  430.  
  431.           array4[i][j+5]=array[i][j];
  432.  
  433.           array5[i][j+5]=array[i][j];
  434.  
  435.          
  436.  
  437.                  }
  438.  
  439.     //    cout<<k<<endl;
  440.  
  441.      for(k=0;k<5;k++){
  442.  
  443.           array4[i][k]=0;
  444.  
  445.           array5[i][k]=0;
  446.  
  447.       }
  448.  
  449.        
  450.  
  451.          
  452.  
  453.      }
  454.  
  455.      
  456.  
  457. cout<<array4[1]<<endl;
  458.  
  459. cout<<array5[1]<<endl;
  460.  
  461.    
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.     bitset < 13 > divisor(string("1000010000000"));
  470.  
  471.     bitset < 13 > divisor2 = divisor;
  472.  
  473.  
  474.  
  475.  
  476.  
  477.     for (i = 0; i < size; i++) {
  478.  
  479.         divisor2 = divisor;
  480.  
  481.       //  cout << array4[i] << endl;
  482.  
  483.  
  484.  
  485.         for (j = 0; j < 8; j++) {
  486.  
  487.                
  488.  
  489.             //  array5[i][j+5]=array[i][j];
  490.  
  491.            while(array4[i][12 - j] == 0 && j<13) {
  492.  
  493.                 divisor2 >>= 1;
  494.  
  495.                 j=j+1;
  496.  
  497.                     }
  498.  
  499.                
  500.  
  501.             if (j < 8) {
  502.  
  503.                 array4[i] = array4[i]^divisor2;
  504.  
  505.           //      cout << array4[i] << endl;
  506.  
  507.                 divisor2 >>= 1;
  508.  
  509.             }
  510.  
  511.                
  512.  
  513.         }
  514.  
  515. for(k=0;k<5;k++){
  516.  
  517.    
  518.  
  519.     array5[i][k]=array4[i][k];
  520.  
  521. }
  522.  
  523.      
  524.  
  525. //cout << array4[i] << endl;
  526.  
  527. //cout << array[i] << endl;
  528.  
  529. //cout << array5[i] << endl;  
  530.  
  531. //outFile3 << array5[i];
  532.  
  533. //outFile3 << endl;
  534.  
  535. if(i==99)
  536.  
  537. cout<<"Son";
  538.  
  539.     }
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  for(i=0;i<err;i++){
  546.  
  547.    j = arr[i];
  548.  
  549.    
  550.  
  551.     array[j]=bitset<8>(rand());
  552.  
  553. }
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  for(i=0;i<size;i++)
  560.  
  561.  {
  562.  
  563.      
  564.  
  565.      for(j=0;j<8;j++)
  566.  
  567.      {
  568.  
  569.          
  570.  
  571.           array4[i][j+5]=array[i][j];
  572.  
  573.           array6[i][j+5]=array[i][j];
  574.  
  575.          
  576.  
  577.                  }
  578.  
  579.     //    cout<<k<<endl;
  580.  
  581.      for(k=0;k<5;k++){
  582.  
  583.           array4[i][k]=0;
  584.  
  585.           array6[i][k]=0;
  586.  
  587.       }
  588.  
  589.  
  590.  
  591.      
  592.  
  593.      }
  594.  
  595.  
  596.  
  597.     for (i = 0; i < size; i++) {
  598.  
  599.         divisor2 = divisor;
  600.  
  601.       //  cout << array4[i] << endl;
  602.  
  603.  
  604.  
  605.         for (j = 0; j < 8; j++) {
  606.  
  607.                
  608.  
  609.             //  array5[i][j+5]=array[i][j];
  610.  
  611.            while(array4[i][12 - j] == 0 && j<13) {
  612.  
  613.                 divisor2 >>= 1;
  614.  
  615.                 j=j+1;
  616.  
  617.                     }
  618.  
  619.                
  620.  
  621.             if (j < 8) {
  622.  
  623.                 array4[i] = array4[i]^divisor2;
  624.  
  625.           //      cout << array4[i] << endl;
  626.  
  627.                 divisor2 >>= 1;
  628.  
  629.             }
  630.  
  631.                
  632.  
  633.         }
  634.  
  635. for(k=0;k<5;k++){
  636.  
  637.    
  638.  
  639.     array6[i][k]=array4[i][k];
  640.  
  641. }
  642.  
  643.      
  644.  
  645. //cout << array4[i] << endl;
  646.  
  647. //cout << array[i] << endl;
  648.  
  649. //cout << array5[i] << endl;  
  650.  
  651. //outFile3 << array5[i];
  652.  
  653. //outFile3 << endl;
  654.  
  655. if(i==99)
  656.  
  657. cout<<"Son"<<endl;
  658.  
  659.     }
  660.  
  661.  
  662.  
  663. for(i=0;i<size;i++){
  664.  
  665.     j=0;
  666.  
  667.     l=0;
  668.  
  669.     for(k=0;k<5;k++){
  670.  
  671.         j+=array5[i][k];
  672.  
  673.         l+=array6[i][k];
  674.  
  675. }
  676.  
  677. if(j!=l){
  678.  
  679. cout<<i<<" "<<array5[i]<<endl;
  680.  
  681. cout<<i<<" "<<array6[i]<<endl;
  682.  
  683. crc1=crc1+1;
  684.  
  685. }
  686.  
  687. }    
  688.  
  689.    // outFile3.close();
  690.  
  691.    
  692.  
  693.     ofstream outFile3;
  694.  
  695.  
  696.  
  697.  
  698.  
  699.     outFile3.open("frames4.txt");
  700.  
  701.  
  702.  
  703.     if (!outFile3) {
  704.  
  705.         cout << "Could not open "
  706.  
  707.             // << file_name
  708.  
  709.              << " file for writing."
  710.  
  711.              << endl;
  712.  
  713.        
  714.  
  715.     }
  716.  
  717.  
  718.  
  719.     for (i = 0; i < size; i++) {
  720.  
  721.         outFile3 << array5[i];
  722.  
  723.         outFile3 << endl;
  724.  
  725.     }
  726.  
  727.  
  728.  
  729.     outFile3.close();
  730.  
  731.     cout<<"Error detection rate for CRC-1 is "<<crc1*size/err<<" %."<<endl;
  732.  
  733.    
  734.  
  735.    
  736.  
  737.    
  738.  
  739.    
  740.  
  741. //For CRC 2   CRC-32
  742.  
  743.  for(i=0;i<size;i++)
  744.  
  745.  {
  746.  
  747.      
  748.  
  749.      for(j=0;j<8;j++)
  750.  
  751.      {
  752.  
  753.          
  754.  
  755.           array8[i][j+32]=array[i][j];
  756.  
  757.           array9[i][j+32]=array[i][j];
  758.  
  759.  
  760.  
  761.                  }
  762.  
  763.  
  764.  
  765.      for(k=0;k<32;k++){
  766.  
  767.           array8[i][k]=0;
  768.  
  769.           array9[i][k]=0;
  770.  
  771.       }
  772.  
  773.        
  774.  
  775.          
  776.  
  777.      }
  778.  
  779.      
  780.  
  781. cout<<array8[1]<<endl;
  782.  
  783. cout<<array9[1]<<endl;
  784.  
  785.  
  786.  
  787.  
  788.  
  789.     bitset < 40 > divisor3(string("1000001001100000100011101101101110000000"));
  790.  
  791.     bitset < 40 > divisor4 = divisor3;
  792.  
  793.    
  794.  
  795.  
  796.  
  797.     for (i = 0; i < size; i++) {
  798.  
  799.         divisor4 = divisor3;
  800.  
  801.  
  802.  
  803.  
  804.  
  805.         for (j = 0; j < 8; j++) {
  806.  
  807.                
  808.  
  809.            while(array8[i][39 - j] == 0 && j<40) {
  810.  
  811.                 divisor4 >>= 1;
  812.  
  813.                 j=j+1;
  814.  
  815.                     }
  816.  
  817.                
  818.  
  819.             if (j < 8) {
  820.  
  821.                 array8[i] = array8[i]^divisor4;
  822.  
  823.  
  824.  
  825.                 divisor4 >>= 1;
  826.  
  827.             }
  828.  
  829.                
  830.  
  831.         }
  832.  
  833. for(k=0;k<32;k++){
  834.  
  835.    
  836.  
  837.     array9[i][k]=array8[i][k];
  838.  
  839. }
  840.  
  841.      
  842.  
  843. if(i==99)
  844.  
  845. cout<<"Son";
  846.  
  847.     }
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  for(i=0;i<err;i++){
  854.  
  855.    j = arr[i];
  856.  
  857.    
  858.  
  859.     array[j]=bitset<8>(rand());
  860.  
  861. }
  862.  
  863.  
  864.  
  865.  
  866.  
  867.  for(i=0;i<size;i++)
  868.  
  869.  {
  870.  
  871.      
  872.  
  873.      for(j=0;j<8;j++)
  874.  
  875.      {
  876.  
  877.          
  878.  
  879.           array8[i][j+32]=array[i][j];
  880.  
  881.           array10[i][j+32]=array[i][j];
  882.  
  883.          
  884.  
  885.                  }
  886.  
  887.      for(k=0;k<32;k++){
  888.  
  889.           array8[i][k]=0;
  890.  
  891.           array10[i][k]=0;
  892.  
  893.       }
  894.  
  895.  
  896.  
  897.      
  898.  
  899.      }
  900.  
  901.  
  902.  
  903.     for (i = 0; i < size; i++) {
  904.  
  905.         divisor4 = divisor3;
  906.  
  907.  
  908.  
  909.         for (j = 0; j < 8; j++) {
  910.  
  911.                
  912.  
  913.            while(array8[i][39 - j] == 0 && j<40) {
  914.  
  915.                 divisor4 >>= 1;
  916.  
  917.                 j=j+1;
  918.  
  919.                     }
  920.  
  921.                
  922.  
  923.             if (j < 8) {
  924.  
  925.                 array8[i] = array8[i]^divisor4;
  926.  
  927.  
  928.  
  929.                 divisor4 >>= 1;
  930.  
  931.             }
  932.  
  933.                
  934.  
  935.         }
  936.  
  937. for(k=0;k<32;k++){
  938.  
  939.    
  940.  
  941.     array10[i][k]=array8[i][k];
  942.  
  943. }
  944.  
  945.      
  946.  
  947. if(i==99)
  948.  
  949. cout<<"Son"<<endl;
  950.  
  951.     }
  952.  
  953.  
  954.  
  955. for(i=0;i<size;i++){
  956.  
  957.     j=0;
  958.  
  959.     l=0;
  960.  
  961.     for(k=0;k<32;k++){
  962.  
  963.         j+=array9[i][k];
  964.  
  965.         l+=array10[i][k];
  966.  
  967. }
  968.  
  969. if(j!=l){
  970.  
  971. cout<<i<<" "<<array9[i]<<endl;
  972.  
  973. cout<<i<<" "<<array10[i]<<endl;
  974.  
  975. crc2=crc2+1;
  976.  
  977. }
  978.  
  979. }  
  980.  
  981.  
  982.  
  983.     cout<<"Error detection rate for CRC-32 is "<<crc2*size/err<<" %."<<endl;
  984.  
  985.    
  986.  
  987.  
  988.  
  989. //For CRC-3  x^7
  990.  
  991.  for(i=0;i<size;i++)
  992.  
  993.  {
  994.  
  995.      
  996.  
  997.      for(j=0;j<8;j++)
  998.  
  999.      {
  1000.  
  1001.          
  1002.  
  1003.           array11[i][j+7]=array[i][j];
  1004.  
  1005.           array12[i][j+7]=array[i][j];
  1006.  
  1007.  
  1008.  
  1009.                  }
  1010.  
  1011.  
  1012.  
  1013.      for(k=0;k<7;k++){
  1014.  
  1015.           array11[i][k]=0;
  1016.  
  1017.           array12[i][k]=0;
  1018.  
  1019.       }
  1020.  
  1021.        
  1022.  
  1023.          
  1024.  
  1025.      }
  1026.  
  1027.      
  1028.  
  1029. cout<<array11[1]<<endl;
  1030.  
  1031. cout<<array12[1]<<endl;
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.     bitset < 15 > divisor5(string("100010110000000"));
  1038.  
  1039.     bitset < 15 > divisor6 = divisor5;
  1040.  
  1041.    
  1042.  
  1043.  
  1044.  
  1045.     for (i = 0; i < size; i++) {
  1046.  
  1047.         divisor6 = divisor5;
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.         for (j = 0; j < 8; j++) {
  1054.  
  1055.                
  1056.  
  1057.            while(array11[i][14 - j] == 0 && j<15) {
  1058.  
  1059.                 divisor6 >>= 1;
  1060.  
  1061.                 j=j+1;
  1062.  
  1063.                     }
  1064.  
  1065.                
  1066.  
  1067.             if (j < 8) {
  1068.  
  1069.                 array11[i] = array11[i]^divisor6;
  1070.  
  1071.  
  1072.  
  1073.                 divisor6 >>= 1;
  1074.  
  1075.             }
  1076.  
  1077.                
  1078.  
  1079.         }
  1080.  
  1081. for(k=0;k<7;k++){
  1082.  
  1083.    
  1084.  
  1085.     array12[i][k]=array11[i][k];
  1086.  
  1087. }
  1088.  
  1089.      
  1090.  
  1091. if(i==99)
  1092.  
  1093. cout<<"Son";
  1094.  
  1095.     }
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  for(i=0;i<err;i++){
  1102.  
  1103.    j = arr[i];
  1104.  
  1105.    
  1106.  
  1107.     array[j]=bitset<8>(rand());
  1108.  
  1109. }
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  for(i=0;i<size;i++)
  1116.  
  1117.  {
  1118.  
  1119.      
  1120.  
  1121.      for(j=0;j<8;j++)
  1122.  
  1123.      {
  1124.  
  1125.          
  1126.  
  1127.           array11[i][j+7]=array[i][j];
  1128.  
  1129.           array13[i][j+7]=array[i][j];
  1130.  
  1131.          
  1132.  
  1133.                  }
  1134.  
  1135.      for(k=0;k<7;k++){
  1136.  
  1137.           array11[i][k]=0;
  1138.  
  1139.           array13[i][k]=0;
  1140.  
  1141.       }
  1142.  
  1143.  
  1144.  
  1145.      
  1146.  
  1147.      }
  1148.  
  1149.  
  1150.  
  1151.     for (i = 0; i < size; i++) {
  1152.  
  1153.         divisor6 = divisor5;
  1154.  
  1155.  
  1156.  
  1157.         for (j = 0; j < 8; j++) {
  1158.  
  1159.                
  1160.  
  1161.            while(array11[i][14 - j] == 0 && j<15) {
  1162.  
  1163.                 divisor6 >>= 1;
  1164.  
  1165.                 j=j+1;
  1166.  
  1167.                     }
  1168.  
  1169.                
  1170.  
  1171.             if (j < 8) {
  1172.  
  1173.                 array11[i] = array11[i]^divisor6;
  1174.  
  1175.  
  1176.  
  1177.                 divisor6 >>= 1;
  1178.  
  1179.             }
  1180.  
  1181.                
  1182.  
  1183.         }
  1184.  
  1185. for(k=0;k<7;k++){
  1186.  
  1187.    
  1188.  
  1189.     array13[i][k]=array11[i][k];
  1190.  
  1191. }
  1192.  
  1193.      
  1194.  
  1195. if(i==99)
  1196.  
  1197. cout<<"Son"<<endl;
  1198.  
  1199.     }
  1200.  
  1201.  
  1202.  
  1203. for(i=0;i<size;i++){
  1204.  
  1205.     j=0;
  1206.  
  1207.     for(k=0;k<7;k++){
  1208.  
  1209.         if(array12[i][k]!=array13[i][k])
  1210.  
  1211.         j=j+1;
  1212.  
  1213. }
  1214.  
  1215. if(j>1){
  1216.  
  1217. cout<<i<<" "<<array12[i]<<endl;
  1218.  
  1219. cout<<i<<" "<<array13[i]<<endl;
  1220.  
  1221. crc3=crc3+1;
  1222.  
  1223. }
  1224.  
  1225. }    
  1226.  
  1227.  
  1228.  
  1229.     cout<<"Error detection rate for CRC-3 is "<<crc3*size/err<<" %."<<endl;
  1230.  
  1231.     return 0;
  1232.  
  1233. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement