Create an encryption program a Create a program with two opt
Solution
/**
 C ++ program that describes the encryption process of files.
 The program open a text file that contains the plain text.
 Then the program opens and read a text file lines.txt
 and encrypt the file lines.txt with password and save
 to linesEncrypt.txt file and decrypt the files
 using encryption file using the password
 and save to linesDecrypted.txt file
 */
 #include<iostream>
 #include<fstream>
 #include<string>
 using namespace std;
 void encryptFileContent(ifstream &inputFileName, int encodeValue, ofstream &outputFileName);
 void decryptFileContent(ifstream &encryptedFileName, int encodeValue, ofstream &decryptedFileName);
 int main()
 {
    char inputFileName[20]=\"lines.txt\";
    int password = 10;
    char outputFileName[20]=\"linesEncrypt.txt\";
    char decryptFileName[20]=\"linesDecrypted.txt\";
   ifstream inputFile;
    inputFile.open(inputFileName);
   ofstream encryptFile;
    encryptFile.open(outputFileName);
encryptFileContent(inputFile, password,encryptFile);
    inputFile.close();
    encryptFile.close();
   
    inputFile.open(outputFileName);
   ofstream decryptFile;
    decryptFile.open(decryptFileName);
   decryptFileContent(inputFile, password,decryptFile);
   
    inputFile.close();
    decryptFile.close();
}
void encryptFileContent(ifstream &inputFileName, int encodeValue, ofstream &outputFileName)
 {
    char data;
    while(inputFileName>>data)
    {          
        outputFileName<<char(data+encodeValue);
    }
 }
 void decryptFileContent(ifstream &encryptedFileName, int encodeValue, ofstream &decryptedFileName)
 {
    char data;
    while(encryptedFileName>>data)
    {      
       
        decryptedFileName<<char(data-encodeValue);
    }
 }
 --------------------------------------------------------
lines.txt
helloword.This is c++ programming.
------------------------------------------------------
Sample Output:
linesEncrypt.txt
rovvyy|n8^rs}s}m55z|yq|kwwsxq8
linesDecrypted.txt
helloword.Thisisc++programming.


