Advertisement
naskedvi

T4 - zad.3.

Mar 24th, 2014
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. void Izvrni(std::string &recenica)
  5. {
  6. int i(0),k(recenica.length()-1);
  7. while(i<k)
  8. {
  9. char pom(recenica[i]);
  10. recenica[i]=recenica[k];
  11. recenica[k]=pom;
  12. i++;
  13. k--;
  14. }
  15. }
  16.  
  17. int main()
  18. {
  19. std::string recenica;
  20. std::cout<<"Unesite recenicu: ";
  21. std::getline(std::cin,recenica);
  22. Izvrni(recenica);
  23. std::cout<<recenica;
  24.  
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement