I have a problem with my decoding program that I'm trying to figure out. It's supposed to read in a encrypted line of code from a .txt file and then by using ASCII values, convert that encrypted code to a decoded version. Example:
Encrypted code:
Fcjjm}rfcpc,
Decoded code: (after adding 2 to every ASCII value - or a key of 2, within ASCII # 32 - 127)
Hello there.
Here is the outline:
If anyone can kinda walk me through this, I would be grateful for all the help! Thanks a lot!Code:#include<iostream> #include<fstream> #include<string> #include<vector> using namespace std; vector<char> read_file(string file_name); string decode(vector<char> encrypted, int key); void display(string decrypted, int key); int main () { vector<char> encrypted = read_file("intercepted.txt"); //Function calls return 0; } vector<char> read_file(string file_name) { ifstream input_file; input_file.open(file_name.c_str()); vector<char> encrypted; // Code to read file input_file.close(); return encrypted; } string decode(vector<char> encrypted, int key) { // Code to decode } void display(string decrypted, int key){ cout << "Key: " << key << " Text: " << decrypted << endl; }



LinkBack URL
About LinkBacks


