Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- void Razmijeni(char &a, char &b)
- {
- char temp(a);
- a = b;
- b = temp;
- }
- void IzvrniString(std::string &s)
- {
- int i(0), j(s.length()-1);
- while(i < j)
- {
- Razmijeni(s[i], s[j]);
- i++;
- j--;
- }
- }
- int main()
- {
- std::string s{"Ovo je neki tekst..."};
- IzvrniString(s);
- std::cout << s;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement