Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. #include <map>
  2. #include <set>
  3. #include <vector>
  4. #include <string>
  5. #include <cstdlib>
  6. #include <iostream>
  7. #include <algorithm>
  8.  
  9. using namespace std;
  10.  
  11. int main(){
  12. map<string,int> indeksy;
  13.  
  14. indeksy["Kowalski"] = 151206;
  15. indeksy["Nowak"] = 161213;
  16. indeksy["Wisniewski"] = 211213;
  17. indeksy.insert(pair<string,int>("Zielinski", 13131313));
  18. cout << indeksy["Nowak"] << endl;
  19. auto it = indeksy.find("Nowak");
  20. if(it != indeksy.end()) cout << it->first << " " << it->second << endl;
  21. cout<<indeksy["Piotrowski"]<<endl;
  22. auto it2 = indeksy.find("Piotrowski");
  23. if(it2 != indeksy.end()) cout << it2->first << " " << it2->second << endl;
  24. else cout << "Nie znalazl" << endl;
  25. cout << "\n\n" << endl;
  26.  
  27. for(auto t : indeksy){
  28. cout << t.first << " " << t.second << endl;
  29. }
  30. cout << "\n\n" << endl;
  31.  
  32. set<int> tab;
  33.  
  34. tab.insert(1);
  35. tab.insert(13);
  36. tab.insert(15);
  37. tab.insert(18);
  38. tab.insert(19);
  39. tab.insert(99999999);
  40.  
  41. for(auto t : tab){
  42. cout << t << endl;
  43. }
  44.  
  45. cout << "\n\n" << endl;
  46.  
  47. vector<int> tab2;
  48.  
  49. tab2.push_back(99999999);
  50. tab2.push_back(1);
  51. tab2.push_back(18);
  52. tab2.push_back(13);
  53. tab2.push_back(15);
  54. tab2.push_back(19);
  55.  
  56. sort(tab2.begin(), tab2.end());
  57.  
  58. for(auto t : tab2){
  59. cout << t << endl;
  60. }
  61.  
  62. return EXIT_SUCCESS;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement