• + 1 comment

    Im new in c++, and met a problem in test case 1, and I don't know where the problem is. Does anyone know the problem? Here's the code:

    #include <cmath>
    #include <cstdio>
    #include <vector>
    #include <iostream>
    #include <algorithm>
    #include <map>
    using namespace std;
    
    
    int main() {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
        int n;
        cin >> n;
        map<string, string> phone;
        
        for (int i=0;i<n;i++){
            string name_temp;
            string phone_temp;
            cin >> name_temp >> phone_temp;
            phone.insert(pair<string, string>(name_temp,phone_temp));
        }
        for (int i=0;i<n;i++){
            string query_temp;
            string out_temp;
            cin >> query_temp;
            map<string, string>::iterator it= phone.find(query_temp);
            if (it!=phone.end()){
                out_temp = it->second;
                cout << query_temp << "=" << out_temp <<endl;
            } else { cout << "Not found" << endl;}
            
        }
        
        return 0;
    }