Q:

C++ Program to Decrypt Files using File Handling

belongs to collection: C++ File Handling Solved Programs

0

Write a C++ Program to Decrypt Files using File Handling. Here’s simple Program to Decrypt Files using File Handling in C++ Programming Language.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Below is the source code for C++ Program to Decrypt Files using File Handling which is successfully compiled and run on Windows System to produce desired output as shown below :

 
 

SOURCE CODE : :

/*  C++ Program to Decrypt Files using File Handling  */

#include<iostream>
#include<stdio.h>
#include<fstream>
#include<stdlib.h>
using namespace std;

int main()
{
        char ch, choice, fname[20];
        fstream fps, fpt;
        cout<<"Enter file name which you have encrypted :: ";
        cin>>fname;

        fps.open(fname);
        if(!fps)
        {
                cout<<"\nError in opening source file..!!";
                cout<<"\nPress any key to exit...";

                exit(1);
        }

        fpt.open("C:\\Users\\acer\\Documents\\file5.txt");

        if(!fpt)
        {
                cout<<"\nError in opening file5.txt file..!!";
                fps.close();
                cout<<"\nPress any key to exit...";

                exit(1);
        }

        while(fpt.eof()==0)
        {
                fpt>>ch;
                ch=ch-100;
                fps<<ch;
        }

        cout<<"\nFile "<<fname<<" decrypted successfully....!!";
        cout<<"\n\nPress any key to exit...\n";
        fps.close();
        fpt.close();
        return 0;
}

OUTPUT : :


/*  C++ Program to Decrypt Files using File Handling  */

Enter file name which you have encrypted :: C:\\Users\\acer\\Documents\\file4.txt

File C:\\Users\\acer\\Documents\\fil!4.txt decrypted successfully....!!

Press any key to exit...

Process returned 0

Above is the source code for C++ Program to Decrypt File using File Handling which is successfully compiled and run on Windows System.The Output of the program is shown above .

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ program to read and write values through objec... >>
<< C++ Program to Encrypt Files using File Handling...