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:还让我试了几个WA,晕,不过也让我知道了有MAP可用,程序借用了,OK??In Reply To:我晕,那错了? Posted by:sunnvya at 2006-09-30 22:27:27 > #include<iostream> > #include<map> > #include<string.h> > using namespace std; > map<char,char>mm; > int main() > { > char ch[30]; > char s[85]; > cin.getline(ch,30,'\n'); > cin.getline(s,85,'\n'); > for(int i=0;i<26;++i) > mm.insert(make_pair(char('a'+i),ch[i])); > int len=strlen(s); > for(int i=0;i<len;++i) > { > if(s[i]>='A'&&s[i]<='Z')cout<<(char)toupper(mm[tolower(s[i])]); > else if(s[i]>='a'&&s[i]<='z')cout<<mm[s[i]]; > else cout<<mm[s[i]];////////=>cout<<s[i]; > > > } > getchar(); > return 0; > } > Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator