加密一个密码
2015-09-16 19:46
274 查看
#include<iostream> #include<stdio.h> #include<string> using namespace std; int main() { int result = 1; int i; int count = 0; char text[128] = { '\0' }; char password[128] = { '\0' }; while (1) { if (result == 1) { cout << "输入密码" << endl; cin >> text; count = strlen(text); for (int i = 0; i < count; i++) { password[i] = text[i] + i + 5; } //password[i] = '\0';//字符串后面的加0 cout << "加密后的密码" << password << endl; } else if (result == 2) { count = strlen(text); for (i = 0; i < count; i++) { text[i] = password[i] - i - 5;//解密码 } /*text[i] = '\0';*/ cout << "解密后的密码" << endl; } else if (result == 3) { break; } else { cout << "输入正确的命令符" << endl; } cout << "输入1:表示原密码加密,输入2表示解密,输入3,表示退出系统" << endl; cin >> result; } system("pause"); return 0; }
相关文章推荐
- Linux之间的文件共享
- asp.net 执行Response.Write后页面变形
- 使用正则限制input框只能输入数字/英文/中文等等
- HDU 5441 Travel (并查集)
- 纯代码实现QQ聊天界面---TableView使用详解
- iOS开发 -- WebSocket 通信(一)
- 在Linux下使用RAID(一):RAID的级别和概念介绍
- Material Design 开发利器:Android Design Support Library 介绍
- Android的开发环境的发展演变
- 软件工程的实践项目的自我目标
- 小猫统计——自定义数据汇总(二)
- 多重继承与虚继承
- 间隙锁(gap lock)个人实验(一)
- 如何不翻墙下载Android代码
- 对于9月16号股市的一点感想
- php将xml文件中的查询具体节点名字下的值
- 第八周第三天
- RAID详解[RAID0/RAID1/RAID5/RAID10]
- EOJ 2832:ZERO(DFS)
- MySQL中的?加关键字查询命令用法