Encryption Decryption // C++ program for the above approach #include #include using namespace std; // encdec class with encrypt() and // decrypt() member functions class encdec { int key; // File name to be encrypt string file = "geeksforgeeks.txt"; char c; public: void encrypt(); void decrypt(); }; // Definition of encryption function void encdec::encrypt() { // Key to be used for encryption cout > key; // Input stream fstream fin, fout; // Open input file // ios::binary- reading file // character by character fin.open(file, fstream::in); fout.open("encrypt.txt", fstream::out); // Reading original file till // end of file while (fin >> noskipws >> c) { int temp = (c + key); // Write temp as char in // output file fout key; fstream fin; fstream fout; fin.open("encrypt.txt", fstream::in); fout.open("decrypt.txt", fstream::out); while (fin >> noskipws >> c) { // Remove the key from the // character int temp = (c - key); fout