| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
哪儿错了啊???麻烦帮忙看看,我快疯了!!#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char key[27], string[81];
int i, l;
scanf("%s", key);
getchar();
gets(string);
l = strlen(string);
string[0] = key[string[0] + 32 - 'a'] - 32;
for (i = 1; i < l; i++)
{
if(string[i] >= 'a' && string[i] <= 'z')
string[i] = key[string[i] - 'a'];
else
if (string[i] >= 'A' && string[i] <= 'Z')
string[i] = key[string[i] + 32 - 'a'];
}
printf("%s", string);
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator