#include<iostream> #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); } }

|