11.4
来源:互联网 发布:四维设计软件 编辑:程序博客网 时间:2024/06/05 19:14
11.37
http://www.cs.fsu.edu/~lacher/courses/COP4531/fall13/lectures/containers2/slide04.html
11.38
@pezy
#include <unordered_map>#include <set>#include <string>#include <iostream>#include <fstream>#include <sstream>using std::string;void wordCounting(){ std::unordered_map<string, size_t> word_count; for (string word; std::cin >> word; ++word_count[word]); for (const auto &w : word_count) std::cout << w.first << " occurs " << w.second << (w.second > 1 ? "times" : "time") << std::endl;}void wordTransformation(){ std::ifstream ifs_map("../data/word_transformation.txt"), ifs_content("../data/given_to_transform.txt"); if (!ifs_map || !ifs_content) { std::cerr << "can't find the documents." << std::endl; return; } std::unordered_map<string, string> trans_map; for (string key, value; ifs_map >> key && getline(ifs_map, value); ) if (value.size() > 1) trans_map[key] = value.substr(1).substr(0, value.find_last_not_of(' ')); for (string text, word; getline(ifs_content, text); std::cout << std::endl) for (std::istringstream iss(text); iss >> word; ) { auto map_it = trans_map.find(word); std::cout << (map_it == trans_map.cend() ? word : map_it->second) << " "; }}
0 0
- 11.4
- 11.4
- 11.4
- 11.4
- 11.4
- 11.4
- 11.4
- 11.4
- 11.4.1
- 11.4.2
- 11.4.3
- cpp 11.4
- Reflection2017.11.4
- 11.4 总结
- 11.4dairy
- 11.4作业
- Java-11.4
- 11.4作业
- 241. Different Ways to Add Parentheses**
- 隐公元年(2)
- Android-MVP+Retrofit+Rxjava实现一个知乎日报客户端
- Android Activity生命周期
- bellman-ford算法模板
- 11.4
- 数据结构——队列的使用(二)
- 136. Single Number
- merchant story
- git遇到的一点小问题
- 活学活用,打开/重启Tomcat的小程序~
- 第一次写CSDN博客
- byte字节数组 转换成double类型
- 洛谷P1220 关路灯