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:高手救我!!!!!!!!!!!!In Reply To:高手救我!!!!!!!!!!!! Posted by:00400000 at 2005-06-03 20:36:36 > #include<iostream> > #include<string> > using namespace std; > void main() > { > string S1("ABCDEFGHIJKLMNOPQRSTUVWXYZ"),S2("VWXYZABCDEFGHIJKLMNOPQRSTU"); > string s1,s2,s3,s4("ENDOFINPUT"); > int i,j; > while(1) > { > cin>>s1; > if(s1.compare(s4)==0) RETURN 0; //you should not use break , for the purpose i do not know.... getline(cin,s3); getline(cin,s3); //because cin does not try to pass the eol and getline will start from the eol, so you need two getline, the first to pass eol and the second to get s3. > cout<<s3; > for(i=0;i<s3.size();i++) > { > if(s3[i]<='Z'&&s3[i]>='A') > { > j=S1.find(s3[i]); > s3[i]=S2[j]; > } > } > cout<<s3<<endl; > cin>>s2; > } > } > Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator