AC代码:
#include <stdio.h>
#include<iostream>
#include<string>
#include<bits/stdc++.h>
using namespace std;
int main()
{
char a[150];
int b[150];
while (gets(a))
{
for (int i = 0; a[i] != '\0'; i++)
{
if (a[i] >= 'a'&&a[i] <= 'j')
{
b[i]=a[i] % 32 - 1;
cout << b[i];
}
else if (a[i] >= '0'&&a[i] <= '9')
{
a[i]= a[i]-'0'+'a';
cout << a[i];
}
else
{
cout << a[i];
}
}
cout << endl;
}
//system("pause");
return 0;
}
编写一个加密程序,用来加密一个字符串。加密规则如下