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:Re:C++ (用cin.ignore解决疑难问题) Posted by:200530501412 at 2007-03-17 21:09: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