Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include "pilha.h"
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int main(int argc, char *argv[]) {
- TPilha *p, *p1, *p2;
- p = criar(100);
- p1 = criar(tamanho(p));
- p2 = criar(tamanho(p));
- empilhar(p, 1);
- empilhar(p, 3);
- empilhar(p, 5);
- empilhar(p, 7);
- empilhar(p, 9);
- exibe(p);
- while(!esta_vazia(p)){
- empilhar(p1, desempilhar(p));
- }
- while(!esta_vazia(p1)){
- empilhar(p2, desempilhar(p1));
- }
- while(!esta_vazia(p2)){
- empilhar(p, desempilhar(p2));
- }
- printf("\n--------------------\n");
- exibe(p);
- /*for(i = 0; i < p->tp; i++){
- empilhar(p1, desempilhar(p));
- }
- for(i = 0; i < p->tp; i++){
- empilhar(p2, desempilhar(p1));
- }
- for(i = 0; i < p->tp; i++){
- empilhar(p, desempilhar(p2));
- }
- printf("\n--------------------\n");
- exibe(p);*/
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement