Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <stack>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main(){
  7. stack<int> pilha;
  8. for(int cont = 0; cont < 10; cont++){
  9. pilha.push(cont);
  10. }
  11.  
  12. cout << pilha.top() << endl;
  13. pilha.pop();
  14. cout << pilha.top() << endl;
  15.  
  16. for(int cont = 0; cont < 9; cont++){
  17. pilha.pop();
  18. if(pilha.empty()){
  19. cout << "Fiquei vazia na iteração: " << cont + 1 << endl;
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement