fork(3) download
  1. #include <iostream>
  2. #include <stack>
  3. using namespace std;
  4.  
  5. void print_stack(stack<char> c) {
  6. while (!c.empty()) {
  7. std::cout<<c.top();
  8. c.pop();
  9. }
  10. }
  11.  
  12. int main() {
  13.  
  14. stack<char> mystack;
  15. mystack.push('a');
  16. mystack.push('b');
  17. mystack.push('c');
  18.  
  19. print_stack(mystack);
  20.  
  21. cout << endl;
  22.  
  23. print_stack(mystack);
  24.  
  25. // your code goes here
  26. return 0;
  27. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
cba
cba