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 |
Re:C++ (用cin.ignore解决疑难问题)In Reply To:C++ (用cin.ignore解决疑难问题) Posted by:wcfairytale at 2007-02-28 14:04:32 //我的solution #include <iostream> #include <string> using namespace std; int main() { string input; char array[26]={'V','W','X','Y','Z','A','B','C','D','E','F', 'G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U'}; unsigned int i; int index; while(1) { getline(cin,input); if(input=="ENDOFINPUT")//end of input break; else if(input=="START"||input=="END")//the start and end continue; else for(i=0;i<input.size();i++) if(input[i]>='A'&&input[i]<='Z') { index=input[i]-'A'; input[i]=array[index];//xlat查表 } cout<<input<<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