Advertisement
avukas

String

Apr 18th, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2. #include<string>
  3.  
  4.  
  5. char pom (char c)
  6. {
  7.     c+=1;
  8.     return c;
  9. }
  10.  
  11. void funkcija(std::string &s, char f(char))
  12. {
  13.     std::string novi="";
  14.     for(int i=0; i<s.size(); i++)
  15.         novi += f(s[i]);
  16.     s = novi;
  17.  
  18. }
  19.  
  20.  
  21.  
  22. int main()
  23. {
  24.  
  25.     std::string s = "abcdfg";
  26.     funkcija(s, pom);
  27.     std::cout<<s;
  28.  
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement