limun11

PRII - Unos teksta i obrnuti ispis - rekurzija

Mar 20th, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void rekurzija()
  5. {
  6.     char text;
  7.     cin >> text;
  8.  
  9.     if (text != '.')
  10.     {
  11.         rekurzija();
  12.         cout << text;
  13.     }
  14.     cout << endl<<"Obrnutim redoslijedom ste unijeli: ";
  15.    
  16. }
  17. void main()
  18. {
  19.    
  20.     cout << "Unesite zeljeni tekst: ";
  21.     rekurzija();
  22.     system("PAUSE");
  23. }
Advertisement
Add Comment
Please, Sign In to add comment