string encrypt( const string& key, const string& s )
{
string result;
// Encrypt s into result here.
...
return result;
}
int main()
{
ifstream infile;
ofstream outfile;
// Open infile and outfile here.
...
string key;
// Get the user's "password" AKA encryption key here.
...
// Encrypt each word in the input file
// Write each encrypted word to the output file
string word;
while (infile >> word)
{
word = encrypt( key, word );
outfile << word << endl;
}
// Check that we processed the input file ok
if (!infile.eof())
{
cout << "Fooey! I failed to encrypt the entire input file.\n";
}
else
{
cout << "Encryption of your file has finished!\n";
}
infile.close();
outfile.close();
return 0; // Please don't exit()...
}