首页 > 其他 > 详细

poj 1298 The Hardest Problem Ever

时间:2014-07-16 21:53:08      阅读:475      评论:0      收藏:0      [点我收藏+]

题目链接: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]!=\0; 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 }

 

poj 1298 The Hardest Problem Ever,布布扣,bubuko.com

poj 1298 The Hardest Problem Ever

原文:http://www.cnblogs.com/qq-star/p/3835612.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!