摘要:
1、map被定义为一对数值,其中的key通常是个字符串,扮演索引的角色,另一个数值为value。字典便是map的一个不错的实体。#include<map>#include<string>map<string, int> words;words["aaaa"] =1;string tword;while(cin>>tword) words[tword]++;2、查询map内是否存在某个key,有三种方法。 1. int count = 0; if(!(count = words["aaa"])) //aaa并 阅读全文
posted @ 2013-06-02 22:24
wiessharling
阅读(184)
评论(0)
推荐(0)

浙公网安备 33010602011771号