Decrypting a file in txt containing ciphertext to a file out

Decrypting a file in. txt containing ciphertext to a file out.txt containing plaintext using shift . Flag -d here refers to decryption. $ cf -d in.txt out.txt Example After running the following command $ ./cf -d 3 f2.txt f3.txt File f3. txt looks like HELLO WORLD THIS IS AMAZING WHY IS THIS SO AMAZING I HAVE NO IDEA 11231

Solution

       
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<fstream.h>
#include<stdlib.h>
void main()
{
     
   char char, choice, f_name[20];
   fstream fpsm, fptm;
   cout<<\"Enter file name (with extension like file.txt) which you have encrypted earlier to decrypt : \";
   gets(f_name);
   fpsm.open(f_name);
   if(!fpsm)
   {
       cout<<\"Error in opening source file..!!\";
       cout<<\"\ Press any key to exit...\";
       getch();
       exit(7);
   }
   fptm.open(\"temp.txt\");
   if(!fptm)
   {
       cout<<\"Error in opening temp.txt file..!!\";
       fpsm.close();
       cout<<\"\ Press any key to exit...\";
       getch();
       exit(9);
   }
   while(fptm.eof()==0)
   {
       fptm>>char;
       ch=ch-100;
       fpsm<<ch;
   }
   cout<<\"File \"<<fname<<\" hello world this is amazing .... why is this so amazing .. i have no idea\";
   cout<<\"\ Press any key to exit...\";
   fpsm.close();
   fptm.close();
   getch();
}

 Decrypting a file in. txt containing ciphertext to a file out.txt containing plaintext using shift . Flag -d here refers to decryption. $ cf -d in.txt out.txt

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site