Josif_tepe

Untitled

Aug 29th, 2025
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <map>
  3. using namespace std;
  4.  
  5. int main() {
  6.    
  7.     map<string, int> oceni;
  8.    
  9.     oceni["Josif"] = 3;
  10.     oceni["Kiril"] = 4;
  11.     oceni["Petar"] = 5;
  12.    
  13.     oceni.insert({"Pero", 1});
  14.     oceni.insert({"Riste", 2});
  15.    
  16.    
  17.     map<string, int>::iterator it = oceni.find("Kire");
  18.    
  19.     if(it != oceni.end()) {
  20.         cout << it->first << " " << it->second << endl;
  21.     }
  22.     else {
  23.         cout << "Ovoj kluc ne postoi" << endl;
  24.     }
  25.     return 0;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment