Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <stdexcept>
- #include <map>
- using namespace std;
- string Sifrirani (string s, map<char,char> m)
- {
- string novi;
- novi.resize(s.length());
- for (int i=0; i<s.length(); i++) {
- for (auto it=m.begin(); it!=m.end(); it++) {
- if (s[i]==it->first)
- novi[i]=it->second;
- }
- }
- return novi;
- }
- int main () {
- string s {"abcbcaccbac"};
- map<char,char> mapa {{'a','x'},{'b','c'},{'c','a'}};
- string rez{Sifrirani(s,mapa)};
- cout<<rez;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement