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> using namespace std; int main() { string start;//开始 string end;//结束 string middle;//输入字符串 while(1) { cin>>start; if(start=="ENDOFINPUT") break; cin.ignore(); getline(cin,middle);//可以接受空格的字符串输入方法 cin>>end; for(int i=0;i<middle.length();i++) { if((int)middle[i]>=65&&(int)middle[i]<=90) cout<<(char)((((int)middle[i]-65)+21)%26+65);//减5相当于加了21 else cout<<middle[i]; } cout<<endl; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator