Advertisement
Guest User

main

a guest
Apr 5th, 2020
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.98 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "pilha.h"
  4.  
  5. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  6.  
  7. int main(int argc, char *argv[]) {
  8.    
  9.     TPilha *p, *p1, *p2;
  10.    
  11.     p = criar(100);
  12.     p1 = criar(tamanho(p));
  13.     p2 = criar(tamanho(p));
  14.    
  15.     empilhar(p, 1);
  16.     empilhar(p, 3);
  17.     empilhar(p, 5);
  18.     empilhar(p, 7);
  19.     empilhar(p, 9);
  20.    
  21.     exibe(p);
  22.        
  23.     while(!esta_vazia(p)){
  24.        
  25.         empilhar(p1, desempilhar(p));
  26.        
  27.     }
  28.     while(!esta_vazia(p1)){
  29.        
  30.         empilhar(p2, desempilhar(p1));
  31.        
  32.     }
  33.     while(!esta_vazia(p2)){
  34.        
  35.         empilhar(p, desempilhar(p2));
  36.        
  37.     }
  38.    
  39.     printf("\n--------------------\n");
  40.    
  41.     exibe(p);
  42.    
  43.     /*for(i = 0; i < p->tp; i++){
  44.        
  45.         empilhar(p1, desempilhar(p));
  46.    
  47.     }
  48.    
  49.     for(i = 0; i < p->tp; i++){
  50.        
  51.         empilhar(p2, desempilhar(p1));
  52.        
  53.     }
  54.    
  55.     for(i = 0; i < p->tp; i++){
  56.        
  57.         empilhar(p, desempilhar(p2));
  58.        
  59.     }
  60.    
  61.    
  62.     printf("\n--------------------\n");
  63.    
  64.     exibe(p);*/
  65.    
  66.    
  67.  
  68.    
  69.    
  70.     return 0;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement