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 |
C++ (用cin.ignore解决疑难问题)#include<iostream> #include<string> using namespace std; int main() { while(true) { string start; cin>>start; if(start=="ENDOFINPUT")break; string text; cin.ignore(1024,'\n');//关键步骤 getline(cin,text); 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; cout<<text<<endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator