1 计算整数位数
思路:转化为字串再计算长度
cout<<to_string(zhengshu).size()<<endl;
2 将纯数字字符串转化为整型
来源:150逆波兰表达式求解
//tokens为 vector<string> tokens
cout<<atoi(tokens[i].c_str())<<endl;
3 map的创建与查找
unordered_map<int,int>m;//似乎用时较少
map<int,int>m//似乎用时较多
m[5]=6;//能像数组那样直接赋值
cout<<m[1]<<endl;//没有赋值的输出0
4 set
unordered_set<int>s;
s.insert(5);//插入5
if(s.find(5)!=s.end())cout<<1<<endl;//会输出1,因为能找到5