-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultiset1.cpp
More file actions
49 lines (42 loc) · 977 Bytes
/
Copy pathmultiset1.cpp
File metadata and controls
49 lines (42 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// main.cpp
// mulitset1
//
// Created by Silly on 14-3-2.
// Copyright (c) 2014年 Silly. All rights reserved.
//
#include <iostream>
#include <set>
using namespace std;
int main(int argc, const char * argv[])
{
multiset<string> ms;
ms.insert("abc");
ms.insert("123");
ms.insert("111");
ms.insert("aaa");
ms.insert("aaa");
ms.insert("123");
multiset<string>::iterator it;
for (it = ms.begin(); it != ms.end(); it++) {
cout << *it << endl;
}
it = ms.find("123");
if (it != ms.end()) {
cout << *it << endl;
} else {
cout << "Not find it" << endl;
}
unsigned long n = ms.erase("123");
cout << "Total deleted : " << n << endl;
for (it = ms.begin(); it != ms.end(); it++) {
cout << *it << endl;
}
it = ms.find("123");
if (it != ms.end()) {
cout << *it << endl;
} else {
cout << "Not find it" << endl;
}
return 0;
}