B2115 密码翻译
很简单的一道字符串的入门,将字符判断范围再减一就行
#include <bits/stdc++.h>//万能头好吃
using namespace std;
int main(){
char s;
while(cin.get(s)){//循环输入
if(s >= 'b' && s <= 'z') s--;//直接减没问题的
else if(s == 'a') s = 'z';
else if(s >= 'B' && s <= 'Z') s--;
else if(s == 'A') s = 'Z';
cout << s;//如果不在if判断内,输出
}
return 0;
}好吧,代码写的有点石,能看