Decrypting a file in txt containing ciphertext to a file out
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();
}
