decrypto.cpp

来自「使用XOR算法进行加解密」· C++ 代码 · 共 46 行

CPP
46
字号

#include <iostream.h>
#include <stdlib.h>
#include <fstream.h>

void Decrypt(char *file2)
   {
   	int decrypto;
      char x;
      ifstream in_file;
      ofstream out_file;
      in_file.open(file2);
      if(in_file.fail())
      {
      	cout <<"\nError opening the file"<<file2
         <<"check that the file currently exists."<<endl;
         exit(1);
      }
      cout <<"Enter a name for the Decrypted file:";
      cin  >>file2;
      out_file.open(file2);
      in_file.get (x);
      if (in_file.eof())
      	return;
      while (x !=EOF)
      {
      decrypto=x+0xFACA+0xFACA;
      out_file<<(char)decrypto;
      in_file.get (x);
      if (in_file.eof())
      	break;
      }
      in_file.close();
      out_file.close();
      return;
	}

int main()
{
	const int MAXLENGHT=25;
   char file2[MAXLENGHT];
   ifstream in_file;
   cout <<"Enter the name of the file you wish to Decrypt:";
   cin >>file2;
   Decrypt(file2);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?