本人新手一枚,闲得无聊写的聊天加密程序,解密程序稍后发。
/*
版权声明:
本文为CSDN博主「Xia Yanze」的原创文章,
遵循CC 4.0 BY-SA版权协议,
转载请附上原文出处链接及本声明。
使用说明:
此为简易字符串加密程序,
仅用于日常使用,
不能用于涉密文件!
*/
#include <cstdio>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
string s;
int x;
int main()
{
printf("下面开始字符串加密程序\n");
cin >> s;
for(int i = 0; i < s.size(); i++)
{
x = (int)s[i];
x = ~x + 1;
if(x < 32)
printf("%d ", x);
else
printf("%c ", x);
}
return 0;
}