#include <iostream>
#include <string>
using namespace std;
void encrypt(string &s)
{
for ( string::iterator it = s.begin(); it != s.end(); ++it)
if (*it == 'z' || *it == 'Z')
*it -= 25;
else if (*it >= 'a' && *it < 'z' || *it >= 'A' && *it < 'Z')
*it += 1;
}
int main()
{
string s = "Hello World";
cout << "Original: " << s << endl;
encrypt(s);
cout << "Encrypted: " << s << endl;
return 0;
}
// output:
Original: Hello World
Encrypted: Ifmmp Xpsme
附注:求赞助积分和C币。加入CSDN将近20年了。最近几年忙小孩没登录。刚才搜索到一本电子书想下载,需要20积分/C币。赞助多少都可以。多谢。