A的ASCII码为65, V的ASCII码为86
#include <cstring>
#include <iostream>
using namespace std;
int main() {
string str;
while (getline(cin,str)) { // 注意 while 处理多个 case
string s;
if(str!="START" && str!="END" && str != "ENDOFINPUT"){
//cout<<str;
for (int i = 0; i < str.size(); i++){
if (str[i] >='A' && str[i] <= 'E'){
str[i] = str[i] -65+86;
}
else if (str[i] >='F' && str[i] <= 'Z'){
str[i] = str[i]-5;
}
if (str[i] == ' '){
}
}
cout << str << endl;
}
}
}
// 64 位输出请用 printf("%lld")

京公网安备 11010502036488号