Advertisement
Guest User

Ejercicio 12 pilas

a guest
Apr 3rd, 2020
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.66 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "../pila.h"
  4. int main()
  5. {
  6.     Pila origen;
  7.     Pila aux;
  8.     Pila aux2;
  9.     inicpila(&origen);
  10.     inicpila(&aux);
  11.     inicpila(&aux2);
  12.  
  13.     apilar(&origen, 7);
  14.     apilar(&origen, 9);
  15.     apilar(&origen, 3);
  16.     printf("La pila originial es: \n  ");
  17.     mostrar(&origen);
  18.     apilar(&aux, desapilar(&origen));
  19.     apilar(&aux2, desapilar(&origen));
  20.     apilar(&aux2, desapilar(&origen));
  21.  
  22.     apilar(&origen, desapilar(&aux));
  23.     apilar(&origen, desapilar(&aux2));
  24.     apilar(&origen, desapilar(&aux2));
  25.  
  26.     printf("La pila ordenada en forma ascendente es:\n");
  27.  
  28.  
  29.     mostrar(&origen);
  30.     return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement