fork download
  1. #include <stack>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. void juegoEnsayo(stack<int>& unaPila)
  7. {
  8. unaPila.push(6);
  9. unaPila.push(9);
  10. unaPila.push(8);
  11. }
  12.  
  13. template<typename T> void printElm(stack<T> mystack)
  14. {
  15. while (!mystack.empty())
  16. {
  17. cout << mystack.top() << " | ";
  18. mystack.pop();
  19. }
  20. }
  21.  
  22. int main()
  23. {
  24. stack<int> pila1;
  25. printElm(pila1);
  26. cout<<endl;
  27. juegoEnsayo(pila1);
  28. printElm(pila1);
  29. return 0;
  30. }
  31.  
  32.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
8 | 9 | 6 |