当我运行它时,它有时会打印出一个空终止字符。大多数情况下,它可能会打印字符,并且可能有 1/5 次会打印字符。
void cryptogram::Encrypt(){
cout<<"encrypt"<<endl;
char Alphabet[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
fin.open("original.txt");
cout<<"file opened";
if(!fin)
{
cout<<"No file exists"<<endl;;
}else{
while(fin>>tempS){
len=tempS.length();
int a=0;
for(int j=0;j<len;j++){
for(a;a<=26;a++){
tempS[j]=toupper(tempS[j]);
if(tempS[j]!=Alphabet[a]){//while two characters arent equal
//if the characters arent equal...a is incremented, to see if the character from the word is equal to the next letter in the alphabet
}else{
cout<<Crypto[a];
//crypto is an array of char filled with letters that are used to encrypt the message
if(j!=len){ //if the word still has more characters
j++;
a=0;
}else{ //if the word is done being scanned
cout<<" ";
}
}
}
}
}
}
}
就是这样,这是有时打印的相应预期输出
xvk bkikhxlr wggbtfkj wiylekgbdhx wjjm hko wigbtubxt xvk iwhj uedjkm glctb gvrmdiwhj iebbdielmeggtbx ctb xvtmk gbtubxvk wjjdxdthgbtubodll khvxvk imkbfdik xt xvk bkudth whj gbtfdjk hko tgxdthm whj tggtbxehdxdkm ctb mxejkhxmibdzdhtltur whj pemxdik mxejdkm mxdh cok wbk wlmt gbkgctb cteb hko zdh cgvrmdikjeiwhj qdhkmdtlturzzkjdydtivkzdmxbrw zdh zdjjlkkjeiwhj w jtixtbdh kjeiwjzdhdmxbittgkbodxv mjme whj艾米
这是通常打印的内容
xvkÈ bkikhxlrÈ wggbtfkjÈ wiylekgbdhxÈ wjjmÈ hkoÈ wigbtubxtÈ xvkÈ iwhjÈ uedjkmÈ glctbÈ gvrmdiwhjÈ iebbdielmeggtbxÈ ctbÈ xvtmkÈ gbtubxvkÈ wjjdxdthgbtubodllÈ khvxvkÈ imkbfdikÈ xtÈ xvkÈ bkudthÈ whjÈ gbtfdjkÈ hkoÈ tgxdthmÈ whjÈ tggtbxehdxdkmÈ ctbÈ mxejkhxmibdzdhtlturÈ whjÈ pemxdikÈ mxejdkmÈ mxdhÈ cokÈ wbkÈ wlmtÈ gbkgctbÈ ctebÈ hkoÈ zdhÈ cgvrmdikjeiwhjÈ qdhkmdtlturzzkjdydtivkzdmxbrwÈ zdhÈ zdjjlkkjeiwhjÈ wÈ jtixtbdhÈ kjeiwjzdhdmxbittgkbodxvÈ mjmeÈ whjÈ艾米
或每个单词末尾的奇数字符的某些变体
顺便说一句,这就是密码数组填充的内容
wyijkcuvdpqlzhtgabmxefonrs
这也是被加密的原始消息
最近批准的学术蓝图为校园增加了新的学术课程,并指导规划这些课程的物理和课程支持。额外的项目将加强对该地区的校园服务,并为学生提供新的选择和机会。犯罪学和司法研究从 2003 年秋季开始。我们还准备在 2004 年秋季开设四个新专业——体育和运动机能学、大众传媒、生物化学、中等教育硕士和教育管理博士(与 SDSU 和加州大学圣地亚哥分校)。
PS对不起,奇怪的格式,刚刚从终端复制并粘贴,试图修复它