noex.cpp
来源: 开始学习 C++
点击上方按钮打开代码编辑器和可视化视图
⚠️ 交互式运行提示
为了防止网页挂起,所有 cin 输入语句已被自动注释。请直接在代码编辑器中修改变量的值来进行测试。
书本配套例题
原始代码预览
#include <iostream>
#include <string>
#include <cmath>
#include <numeric>
#include <vector>
#include <algorithm>
#include <unordered_set>
using namespace std;
struct S {double a; double b;};
int main()
{
S a = {1.1,2.2};
S b = {2.1,4.2};
S c = {3.1,5.2};
unordered_set<S*> us;
us.insert(&a);
us.insert(&b);
us.insert(&c);
for_each(us.begin(),us.end(),[](S* i) {cout << (*i).a << ", ";});
cout << "\nNext\n";
/* if(pt != vi.end())
cout << *pt << endl;
else
cout << "not found\n";
cout << vi.count("cow") << endl;
cout << vi.count("fondu") << endl;
cout << endl;
cout << *vi.lower_bound("cow") << endl;
cout << *vi.upper_bound("hen") << endl;
cout << vi.bucket_count() << endl;
cout << vi.bucket("cow") << endl;
cout << vi.bucket("starkA") << endl;
cout << vi.bucket("stark") << endl;*/
cin.get();
}
运行结果 / 调试信息
等待编译...
本节课暂无动态演示