밀를 받 는 내 는 램
~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(); }