typedef关键字
2023-12-30 15:12:26
发布于:广东
2阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
typedef char str;
str cha(str h){
if(h >= 'a' and h <= 'w' or h >= 'A' and h <= 'W'){
return (char)(h + 3);
}else if(h >= 'x' and h <= 'z' or h >= 'X' and h <= 'Z'){
return (char)(h - 23);
}
}
str caps(str h){
if(h >= 'A' and h <= 'Z'){
return (char)(h + 32);
}else{
return (char)(h - 32);
}
}
int main(){
char k[1100], a[1100], b[1100];
cin >> k;
int len = strlen(k);
for(int i = 0; i < len; i++){
a[i] = cha(k[i]);
}
for(int i = len - 1; i >= 0; i--){
b[len - i] = a[i];
}
for(int i = 1; i <= len; i++){
cout << caps(b[i]);
}
return 0;
}
这里空空如也
有帮助,赞一个