wangzhengquan
2020-09-17 f6d7dbd2ac6938526b1023d1bc571d562b4625cf
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
#include <map>  
  
#include <string>  
  
#include <iostream>  
  
using namespace std;  
  
int main()  
  
{  
  
    map<int, string> mapStudent;  
  
    mapStudent.insert(pair<int, string>(1, "student_one"));  
  
    mapStudent.insert(pair<int, string>(2, "student_two"));  
  
    mapStudent.insert(pair<int, string>(3, "student_three"));  
  
    map<int, string>::iterator iter;  
  
    iter = mapStudent.find(1);  
 
     
  
    
  
    if(iter != mapStudent.end())  
  
       cout << iter->first << ", Find, the value is "<<iter->second<<endl;  
  
    else  
  
       cout<<"Do not Find"<<endl;  
      
    return 0;  
}