hdu What Are You Talking About(map)

时间:2024-10-17 21:35:39

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1075

map简单应用

代码:

 #include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <iostream>
#include <ctype.h>
#include <iomanip>
#include <queue>
#include <map>
#include <stdlib.h>
using namespace std; int main()
{
char b[],s1[],s2[],ch;
map<string,string> mp;
int d=;
gets(b);
while(scanf("%s%s",s1,s2),strcmp(s1,"END")){
mp[s2]=s1;
}
getchar();
while(scanf("%c",&ch)){
if(isalpha(ch))
b[d++]=ch;
else{
b[d]='\0';d=;
if(strcmp(b,"END")==)
break;
if(mp.find(b)!=mp.end())
cout<<mp[b];
else
printf("%s",b);
putchar(ch);
}
}
}

map学习链接:http://www.cnblogs.com/tianfang/archive/2006/12/30/607859.html

http://blog.****.net/yu_yuan_1314/article/details/9794435

http://blog.****.net/sanwenyublog/article/details/18006749