Question: can someone help me write a decryption code for this code #include //just for writing and reading from console #include //this one to deal with

can someone help me write a decryption code for this code

#include

//just for writing and reading from console

#include

//this one to deal with files, read and write to text files

using namespace std;

int main()

{

//first thing we need to read the data in the text file

//let's assume we have the reading in a text file called data.txt

//so, we need a stream input variable to hold this data

ifstream infile;

//now we copy the data from the file into this variable

infile.open("data.txt");

//now we have the text copied to this stream

//first thing we need to check if the file is open or not

if(!infile.eof())

//

{

cout<<"Error opening the file.";

return -1; //this line will end the program

}

//here we need to open the file that we will print

//the output to, that is the encrypted file

ofstream outfile;

outfile.open("out.txt"); //this will create an out file to write in later

//here we need to make a loop to change each character in the file

string line; //this will hold the string in each line in the infile

while(outfile.getline(line)) //this statement copies data

{

//here we make the encryption on the line, and then print it back into

//the output file

for(int i=0;i

{

line[i] += 3;

}

//now the line has been encrypted

//we pass it to the out file

outfile<

}

//now we close both files

infile.close();

outfile.close();

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!