fork download
  1. #include <iostream>
  2. #include <stack>
  3. using namespace std;
  4. int main() {
  5. stack <int> s;
  6. s.push(5);
  7. s.push(12);
  8. s.push(7);
  9. s.push(6);
  10. s.push(19);
  11. while(!s.empty()){
  12. cout << s.top() << endl;
  13. s.pop();
  14. }
  15.  
  16.  
  17. if(!s.empty())
  18. s.pop();
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 3464KB
stdin
Standard input is empty
stdout
19
6
7
12
5