作业题,请教中...从""(char)(32)到(char)127加密,产生的key不能是顺序的,而且是单一的.Original: fghijklmnopqrstu
Key: abcdefghijklmnopin that order.In task 2 the letter can be anywhereOriginal: fghijklmnopqrstu
Key: kdiowneartpjmqglThe following would not be a valid keyOriginal: fghijklmnopqrstu
Key: asdfddasdfjkpprdbecause many of the characters appear twice or more times. E.g d appears 3 times.想来想去,找不好的算法.math.radom使用不能多于95次,求助中
Key: abcdefghijklmnopin that order.In task 2 the letter can be anywhereOriginal: fghijklmnopqrstu
Key: kdiowneartpjmqglThe following would not be a valid keyOriginal: fghijklmnopqrstu
Key: asdfddasdfjkpprdbecause many of the characters appear twice or more times. E.g d appears 3 times.想来想去,找不好的算法.math.radom使用不能多于95次,求助中
#include<fstream>
void main(void)
{
char strch,ch;
int i,x;
ifstream readfile;
ofstream writefile;
readfile.open("1.txt",ios::in | ios::nocreate);
if(!readfile)
{
cerr<<"cannot open thie file for input"<<endl;
exit(0); }
writefile.open("2.txt",ios::in | ios::nocreate);
if(!writefile)
{
cerr<<"cannot open the file for output"<<endl;
exit(0); }
while(!readfile.eof())
{
ch=readfile.get();
x=static_cast<int>(ch);
x=(x+3)%128;
strch=static_cast<char>(x);
writefile.put(strch);
}
}这是一个用C++编的加密.很简单就是位移3.但是我需要的是位移每次都不一样,而且是这能字母不能出现二次,radom算法不能多于95次...