JosepRivaille

P42156: Girant una llista de paraules (5)

Apr 9th, 2015
834
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. void girar_llista(int& count) {
  6.     string x;
  7.     if (cin >> x) {
  8.         ++count;
  9.         girar_llista(count);
  10.         if (count > 0) {
  11.             cout << x << endl;
  12.             count = count - 2;
  13.         }
  14.     }
  15. }
  16.  
  17. int main() {
  18.     int count = 0;
  19.     girar_llista(count);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment