키 파 호화 하
~cpp #include <iostream> #include <fstream> using namespace std; void main() { char filename[10]; cout << "파 : "; cin >> filename; ifstream fin(filename); ofstream fout("encode.txt"); char key; cout << "키 : "; cin >> key; cout << "..."<< endl; char ch; while( !fin.eof() ){ ch = fin.get(); ch += key;//호화 fout << ch; cout << ch; } cout << endl; fin.close(); fout.close(); }
~cpp #include <iostream> #include <fstream> using namespace std; void main() { char filename[10]; cout << "파 : "; cin >> filename; ifstream fin(filename); ofstream fout("decode.txt"); char key; cout << "키 : "; cin >> key; cout << "..."<< endl; char ch; while( !fin.eof() ){ ch = fin.get(); ch -= key;//호화 fout << ch; cout << ch; } cout << endl; fin.close(); fout.close(); }