📄 testhashmap.cpp
字号:
#include "hashmap.h"#include <iostream>using namespace std;int main(int argc, char** argv){ hashmap<int, int> myHash; myHash.insert(make_pair(4, 40)); myHash.insert(make_pair(6, 60)); hashmap<int, int>::value_type* x = myHash.find(4); if (x != NULL) { cout << "4 maps to " << x->second << endl; } else { cout << "cannot find 4 in map\n"; } myHash.erase(4); hashmap<int, int>::value_type* x2 = myHash.find(4); if (x2 != NULL) { cout << "4 maps to " << x2->second << endl; } else { cout << "cannot find 4 in map\n"; } myHash[4] = 35; myHash[4] = 60; hashmap<int, int>::value_type* x3 = myHash.find(4); if (x3 != NULL) { cout << "4 maps to " << x3->second << endl; } else { cout << "cannot find 4 in map\n"; } return (0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -