#include
#include
#include
using namespace std;
Int main ()
{
A string of M;
String P;
String FCS.
String MTemp;
Ifstream MFile (" F: \ \ \ \ \ \ study matters sophomores computer network \ \ CRC \ \ input_M TXT ");
Ifstream PFile (" F: \ \ \ \ \ \ study matters sophomores computer network \ \ CRC \ \ input_P TXT ");
Ofstream FCSFile (" F: \ \ \ \ \ \ study matters sophomores computer network \ \ CRC \ \ output_FCS TXT ");
Getline (MFile, M);
Getline (PFile, P);
MTemp=M;
MTemp. Append (P.l ength () - 1, '0');
For (unsigned int I=0; i<=MTemp. Length () - P.l ength (); I++)
{
If (MTemp [I]=='0')
continue;
String MSubTemp=MTemp. Substr (I, P.l ength ());
For (unsigned int j=0; j
Stringstream temp.
Temp<(MSubTemp [j] ^ P [j]);
String strTemp=temp. STR ();
MSubTemp. Replace (j, 1, strTemp);
}
MTemp. Replace (I, P.l ength (), MSubTemp);
}
FCS=MTemp. Substr (MTemp. Length () - P.l ength () + 1, P.l ength () - 1);
FCSFile
PFile. Close ();
FCSFile. Close ();
cout<" M: "& lt;
return 0;
}
CodePudding user response:
https://www.baidu.com/s? Wd=CRC 90% % % % 20 c % E6 BA A0 E7 A3 BB E4 % % % % % 81 & amp; Rsv_spt=1 & amp; Issp=1 & amp; F=8 & amp; Rsv_bp=0 & amp; Rsv_idx=2 & amp; Ie=utf-8 & amp; Tn=baiduhome_pg & amp; Rsv_enter=0 & amp; Rsv_sug3=19 & amp; Rsv_sug1=10 & amp; Rsv_pq=f74fa02f000033d5 & amp; Rsv_t=234 enycbguf9zb2edsirmsspistz3jw5%2 bpzvf7gg % 2 frdr3mbsyqq8%2 brzfdbgkyewdivad & amp; InputT=12850 & amp; Rsv_sug4=12850CodePudding user response:
Well what I want is the same as the above code can pass two text input data and then through the text file output, direct modify the code above can help you with