Encrypt/Decrypt string

/* i need to encrypt and decrypt a string, using the following syntax. I need help with the encrypt/decrypt functions. I have to use the ASCII chart and i'm unsure of how to do so. I'm also unsure of how to put the functions into a file. This is my code so far: */

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

std::string encrypt(std::string filename, int key);
void decrypt(std::string encrypted, int key);

string encrypt(string filename, int key)
{
ofstream myfile;
myfile.open(filename.c_str());

}

void decrypt(std::string encrypted, int key)
{


return ;
}

int main ()
{
int rot = 5;
string filename = "hw.txt";
string key = "The quick brown fox jumps over the lazy dog!";

ofstream myfile;
myfile.open(filename.c_str());
myfile<<key<<" ";

encrypt(filename, rot);

myfile.close();

return 0;
}
I can't really tell how you want to encrypt the characters? You have a 'rot' variable which makes me think ROT(N) cypher, but you also have a key string (although you aren't actually doing anything with it).
Topic archived. No new replies allowed.