C/C++:移位密码穷举解密
2014-10-16 23:28
211 查看
#include<iostream> using namespace std; #define N 1000 void decrypt(char x ) { for(int i=1;i<=25;++i) { for(int j=0;;++j) { if(x[j]>96&&x[j]<123) x[j]=(x[j]-1-122)%26+122; else if(x[j]>64&&x[j]<91) x[j]=(x[j]-1-90)%26+90; else x[j]=x[j]; if(x[j]==0) break; } cout<<"The result is:"<<x<<endl; } } int main() { char x = {0}; cout<<"Please enter the message:"; cin.getline(x,N); decrypt(x); return 0; }
相关文章推荐
- C++ FAQ Lite[8]--引用(更新)
- 开发工具大比拚之Visual C++ vs. Delphi(三)
- 开发工具大比拚之Visual C++ vs. Delphi(二)
- 开发工具大比拚之Visual C++ vs. Delphi(一)
- Byte杂志C++调查报告
- 对今年内将出版的几本C++书的简评
- VC不是梦想,C++需要自由的心
- C++之父B. Stroustrup近期言论
- 用纯粹的C++编写COM组件
- C++中建立对象间消息连接的一种系统方法
- 在Delphi与C++之间实现函数与对象共享
- C/C++的思索 C++之父访谈录 [上帝的玩笑吗?]
- 突破C++的虚拟指针--C++程序的缓冲区溢出攻击
- C++: BIG5到GB
- 浅谈C++中运算符重载
- C++ FAQ Lite[13]--算符重载(新)
- C++ FAQ Lite[7]--类和对象(更新)
- C++ FAQ Lite[17]--异常和错误处理(更新)
- C++ FAQ Lite[9]--内联函数(更新)