1 Star 0 Fork 1

saigon/Algorithms

forked from charlieshu/Algorithms 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
文件加密_未完成.cpp 1.01 KB
一键复制 编辑 原始数据 按行查看 历史
charlie 提交于 2024-01-09 00:01 . move from github to gitee
#include <iostream>
#include <cstring>
using namespace std;
void encryption(){
string user;
cout<<"document name?\n:";
cin>>user;
FILE *fin,*fout;
fin = fopen(user.c_str(),"r");
fout = fopen("encryption.txt","w");
string enc="";
fscanf(fin,"%s<end>",enc.c_str());
cout<<"start working(i="<<enc.length()<<")"<<endl;
for(int i=0;i<enc.length();i++){
fprintf(fout,"%c",enc[i]+1);
cout<<"handling:"<<i<<endl;
}
fclose(fin);
fclose(fout);
return;
}
void deciphering(){
string user;
cout<<"document name?\n:";
cin>>user;
FILE *fin,*fout;
fin = fopen(user.c_str(),"r");
fout = fopen("deciphering.txt","w");
string enc="";
fscanf(fin,"%s<end>",enc.c_str());
for(int i=0;i<enc.length();i++){
fprintf(fout,"%c",enc[i]-1);
cout<<"handle:"<<i<<endl;
}
fclose(fin);
fclose(fout);
return;
}
int main(){
cout<<"encryption or deciphering?\n:";
char user;
cin>>user;
if(user == 'e')
encryption();
else if(user == 'd')
deciphering();
return 0;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/saigonshu/algorithm.git
git@gitee.com:saigonshu/algorithm.git
saigonshu
algorithm
Algorithms
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385