SHARE
TWEET

Untitled

a guest Sep 16th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top