poj 1298 The Hardest Problem Ever

题目链接:http://poj.org/problem?id=1298

题目大意:按照所给的顺序要求将输入的字符串进行排列。

 1 #include <iostream>
 2 #include <cstdio>
 3 #include <cstring>
 4 using namespace std;
 5 int main ()
 6 {
 7     char str[27]= {"VWXYZABCDEFGHIJKLMNOPQRSTU"};
 8     char ch[100];
 9 
10     while (1)
11     {
12         gets(ch);
13         if (strcmp(ch,"START")==0)//strcmp是字符的一个函数,也就是两者之间的比较
14             continue;
15         else if (strcmp(ch,"END")==0)
16             continue;
17         else if (strcmp(ch,"ENDOFINPUT")==0)
18             break;
19         for (int i=0; ch[i]!=''; i++)
20         {
21             if (!(ch[i]>='A'&&ch[i]<='Z'))
22                 continue;
23             ch[i]=str[ch[i]-65];//运用ASCII进行字符之间的相互转换
24         }
25         puts(ch);
26     }
27     return 0;
28 }
原文地址:https://www.cnblogs.com/qq-star/p/3835612.html