we are going to be creating a basic encryption/decryption function. The principl
ID: 3675957 • Letter: W
Question
we are going to be creating a basic encryption/decryption function. The principle function we are writing will call an encrypt function and/or a decrypt function. Normally, I wouldn't spec the additional functions for you to write but for this lab I'm listing at least 3 functions you need to write. Our encryption is going to be basic. If a letter is simply going to be replaced with a different letter from the alphabet. Use this scheme when encrypting or decrypting: a == z b == y c == x d == w e == v f == u g == t h == s i == r j == q k == p l == o m == n
Requirements
You must write your method signatures in a file called: encrypt.h
You must write the principle function with signature: void encryptDecrypt( string inputfile, string outputfile );
this is in c++
Explanation / Answer
encrypt.h
#ifndef ENCRYPT_H_INCLUDED
#define ENCRYPT_H_INCLUDED
void encryptDecrypt(string inputfile,string outputfile ){
char ch;
fstream fin(inputfile.c_str(), fstream::in);
fstream fout(outputfile.c_str(), fstream::out);
while (fin >> noskipws >> ch) {
fout << (char)('z'-(ch-97));
}
fin.close();
fout.close();
}
#endif // ENCRYPT_H_INCLUDE
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.