#include<iostream>
#include<string>
using namespace std;
// 简单的加密算法 凯撒密码算法
char * crypo(string massage)
{
char * ciper = new char[massage.size()];
for(int i = 0; i < massage.size(); i++)
{
ciper[i] = massage.at(i) + 3;
}
return ciper;
}
int main()
{
cout << "input a massage"<<endl;
string massage;
getline(cin, massage);
// cout<<"massage is :" << massage<<endl;
cout<<"the ciper is :"<<endl;
char * ciper = crypo(massage);
for(int i = 0; i < massage.size(); i++)
cout<<ciper[i];
cout<<endl;
return 0;
}
输出结果:
PS D:\c_cpp_simulation> .\crypo.exe
input a massage
我是一个大帅哥吗
the ciper is :
颜褪站基扶为魂朋