POJ 2503——map

mac2022-06-30  31

#include<iostream> #include<cstring> #include<string> #include<map> #include<stdio.h> using namespace std; int main() { map<string,string> d; char str1[12],str2[12],str[30]; while(gets(str)) { if(strlen(str)==0) break; sscanf(str,"%s %s",str1,str2); d[str2]=str1; } string str3,p_out; while(cin>>str3) { p_out=d[string(str3)]; if(p_out.length()==0) cout<<"eh"<<endl; else cout<<p_out<<endl; } return 0; }

转载于:https://www.cnblogs.com/cyiner/archive/2011/07/10/2102493.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)