Advertisement
Lauda

Untitled

Feb 20th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <map>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.  
  9.     string txt;
  10.  
  11.     map<string, string> rijecnik;
  12.  
  13.     rijecnik["black"] = "crno";
  14.     rijecnik["football"] = "fudbal";
  15.     rijecnik["book"] = "knjiga";
  16.  
  17.     cout << "Unesite rijec: " << endl;
  18.     getline(cin, txt);
  19.  
  20.     if (rijecnik.find(txt) != rijecnik.end())
  21.         cout << rijecnik[txt];
  22.     else
  23.         cout << "Rijec nije pronadjena!";
  24.  
  25.     return 0;
  26.  
  27. }
  28.  
  29.  
  30. #include <iostream>
  31. #include <string>
  32. #include <vector>
  33. #include <algorithm>
  34.  
  35. using namespace std;
  36.  
  37. int main() {
  38.  
  39.     int unos;
  40.  
  41.     vector<int> v;
  42.  
  43.     cout << "Unesite 5 brojeva: " << endl;
  44.     for (int i=1; i<=5; i++)
  45.     {
  46.         cout << "Unesite " << i << ". broj" << endl;
  47.         cin >> unos;
  48.         v.push_back(unos);
  49.     }
  50.  
  51.     cout << "Max. element je: " << *max_element(v.begin(), v.end()) << endl;
  52.  
  53.     return 0;
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement