······
include <iostream>
include <string>
using namespace std;
int main() {
string str = "VWXYZABCDEFGHIJKLMNOPQRSTU";
string inputStr;
int i;
while (1) {
getline(cin, inputStr);
if (inputStr == "ENDOFINPUT") break;
getline(cin, inputStr);
for (i = 0; inputStr[i] != '\0'; i++) {
if (inputStr[i] >= 'A'&&inputStr[i] <= 'Z') {
cout << str[inputStr[i] - 'A'];
}
else {
cout << inputStr[i];
}
}
cout << endl;
getline(cin, inputStr);
}
system("pause");
return 0;
}
······
感觉这道题改编为cpp还是有点难度的
网友评论