Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

file encryption is the science of writing the contents of a file in a secret cod

ID: 3865204 • Letter: F

Question

file encryption is the science of writing the contents of a file in a secret code.
Your encryption program should work like a filter, reading the contents of one file, modifying the data into
a code, and then writing the coded contents out to a second file. aThe second file will be a version of the first
file, but written in a secret code.

Although there are complex encryption techniques, you should come up with a simple of your own
For example, you could read the first file one character at a time, and add 10 to the
ASCII code of each character before it is written to the second file.

Explanation / Answer

Source code:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
char ch;
fstream fin, fout;
fin.open("plainfile.txt", ios::in); fout.open("encryptedfile.txt", ios::out);
while (!fin.eof())
{
fin.get(ch);
fout.put(ch + 10);
}
fin.close();
fout.close();
system("pause");
return 0;
}
Output:

Input file with plain text and it will generate output file with encrypted message.