您的位置:首页 > 其它

POJ 1298

2015-06-09 13:54 411 查看
#include<iostream>//  chengdacaizi 注释!2008 11 05
#include<string>
using namespace std;

int main()
{
while(true)
{
string start;//用于控制循环
cin>>start;//
if(start=="ENDOFINPUT")break;
string text;//密码字符串;
cin.ignore(1024,'\n');//关键步骤 忽略除了‘\n’以外的一切字符 包括'\0'
getline(cin,text);//用getline(cin,&string)输入字符串
int K;
for(K=0;K<text.size();++K)
{
if('A'<=text[K] && text[K]<='Z')//对密码进行翻译;
{
if(text[K]<'A'+5)text[K]+=21;
else text[K]-=5;
}
}
string end;
cin>>end;//存放"END";
cout<<text<<endl;// 输出翻译后的密码!
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: