题目1134:密码翻译

#include 
#include 
#include 

using namespace std;

const int N = 90;

char buf[N];

int main()
{
    int n;

    #ifndef ONLINE_JUDGE
        freopen("d:\\OJ\\uva_in.txt", "r", stdin);
    #endif // ONLINE_JUDGE

    while (gets(buf)) {
        n = atoi(buf);
        for (int i = 0; i < n; i++) {
            gets(buf);
            for (int j = 0; buf[j]; j++) {
                if (isalpha(buf[j])) {
                    if (buf[j] == 'z') buf[j] = 'a';
                    else if (buf[j] == 'Z') buf[j] = 'A';
                    else buf[j] += 1;
                }
            }

            puts(buf);
        }
    }
    return 0;
}

你可能感兴趣的:(#,九度)