首页 > 应用开发 > IT综合 > 一个简单的恺撒加密程序 (转)
#include
#include
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"<
writefile.open("2.txt",ios::in | ios::nocreate);
if(!writefile)
{
cerr<<"cannot open the file for output"<
while(!readfile.eof())
{
ch=readfile.get();
x=static_cast
x=(x+3)%128;
strch=static_cast
writefile.put(strch);
}
}
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10752019/viewspace-979946/ ,如需转载,请注明出处,否则将追究法律责任。