Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <set>
- #include <map>
- using namespace std;
- void PrintSet(const set <string>& s)
- {
- cout << "Size = " << s.size() << endl;
- for (auto x : s) // перестали копировать очередную пару ключ - значение в переменную item c помощью константной ссылки
- {
- cout << x << endl;
- }
- }
- int main()
- {
- set<string> month_names = { "January", "March", "February", "March" };
- set<string> other_month_names = { "March", "January", "February" };
- cout << (month_names == other_month_names) << endl; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- //cout << month_names.count("January") << endl;
- map<string, int> months = { {"January", 1}, {"February", 2}};
- //cout << months.count("January") << endl;
- vector<string> v = { "a", "b", "a" };
- set<string> s(begin(v), end(v));
- PrintSet(s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement