中文octave安装教程
时间: 2023-10-16 11:07:31 浏览: 67
octave中文学习手册
5星 · 资源好评率100%
加密程序:
```
#include <iostream>
using namespace std;
int main() {
int num;
cout << "请输入明码:";
cin >> num;
int digit1 = (num / 100000 + 7) % 10;
int digit2 = (num / 10000 % 10 + 7) % 10;
int digit3 = (num / 1000 % 10 + 7) % 10;
int digit4 = (num / 100 % 10 + 7) % 10;
int digit5 = (num / 10 % 10 + 7) % 10;
int digit6 = (num % 10 + 7) % 10;
int cipher = digit6 * 100000 + digit5 * 10000 + digit4 * 1000 + digit3 * 100 + digit2 * 10 + digit1;
cout << "密码为:" << cipher << endl;
return 0;
}
```
解密程序:
```
#include <iostream>
using namespace std;
int main() {
int cipher;
cout << "请输入密码:";
cin >> cipher;
int digit1 = (cipher % 10 + 3) % 10;
int digit2 = (cipher / 10 % 10 + 3) % 10;
int digit3 = (cipher / 100 % 10 + 3) % 10;
int digit4 = (cipher / 1000 % 10 + 3) % 10;
int digit5 = (cipher / 10000 % 10 + 3) % 10;
int digit6 = (cipher / 100000 + 3) % 10;
if (digit1 < 0 || digit2 < 0 || digit3 < 0 || digit4 < 0 || digit5 < 0 || digit6 < 0) {
cout << "解密错误!" << endl;
return 0;
}
int num = digit1 * 100000 + digit2 * 10000 + digit3 * 1000 + digit4 * 100 + digit5 * 10 + digit6;
cout << "明码为:" << num << endl;
return 0;
}
```
阅读全文