www.pudn.com > Caesar.rar > Caesar.cpp
#include#include void main() { int key=0; char text[8000]={0}; char te[100]; //cin>>te; //te="fewfe wefe"; cin>>key; ifstream fin; ofstream fout; fout.open ("g:\cipher.sp",ios::noreplace||ios::nocreate); fin.open ("g:\plain.pl",ios::in); if(!fout) { cout<<"Can't open the file cipher.sp"< ='a'&&text[i]<='z') { text[i]=(text[i]-'a'+key)%26+'a'; } if(text[i]>='A'&&text[i]<='Z') { text[i]=(text[i]-'A'+key)%26+'A'; } } fout.write (text,sizeof(text)); fin.close() ; fout.close() ; }