算法一 : 凯撒加密 (只能对英文的txt) 将每个字符的ASCII码相对于设置的偏移量偏移
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream iFile("D:\\测试1.txt"); //建立输入文件流对象
iFile.seekg(0, ios::end);
int nFileLen = iFile.tellg();
iFile.seekg(0, ios::beg);
char *str = new char[nFileLen + 1];
iFile.read(str, nFileLen);
iFile.close();
str[nFileLen] = 0;
int nCaesar = 5; //设置偏移量
int n = 0; //记录回车数目
for (int i = 0; i < nFileLen; i++)
{
if ((str[i] >= 'a') && (str[i] <= 'z'))
{
str[i] += nCaesar;
if (str[i] > 'z')
str[i] -= 26;
}
else if ((str[i] >= 'A') && (str[i] <= 'Z'))
{