Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <algorithm>
- #include <map>
- #include <vector>
- std::string ZamijeniPremaRjecniku(std::string &recenica, std::map<std::string, std::string> mapa)
- {
- std::vector<std::string> v_rijeci;
- std::string rijec="";
- bool nasao = false;
- for (int i=0; i<recenica.size(); i++)
- {
- if(recenica[i]==' ')
- {
- if (nasao)
- v_rijeci.push_back(rijec);
- rijec = "";
- nasao = false;
- continue;
- }
- else
- {
- nasao = true;
- rijec += recenica[i];
- }
- }
- return recenica;
- }
- int main()
- {
- std::map<std::string, std::string> moj_rjecnik{{"jabuka", "apple"},
- {"da", "yes"}, {"kako", "how"}, {"ne", "no"}, {"majmun", "monkey"}};
- std::cout << ZamijeniPremaRjecniku("kako da ne", rjecnik);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement