希望大佬高抬贵手解答一下,谢谢
愿意的话,可不可以交个朋友,我是新手
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string decryptString(const string& encrypted) {
string decrypted = encrypted;
for (int i = 0; i < decrypted.length(); i++) {
if (isalpha(decrypted[i])) {
decrypted[i] = ((decrypted[i] - 'A' + 3) % 26) + 'A';
}
}
reverse(decrypted.begin(), decrypted.end());
for (int i = 0; i < decrypted.length(); i++) {
if (islower(decrypted[i])) {
decrypted[i] = toupper(decrypted[i]);
} else if (isupper(decrypted[i])) {
decrypted[i] = tolower(decrypted[i]);
}
}
return decrypted;
}
int main() {
string encrypted;
cin >> encrypted;
string decrypted = decryptString(encrypted);
cout << decrypted << endl;
return 0;
}```