·
Análise de Sistemas ·
Introdução à Lógica e Programação
Send your question to AI and receive an answer instantly
Recommended for you
Preview text
Trabalho Criar e fazer rodar os códigos dos exemplos de pilha include struct Pilha int topo posição elemento topo int capa float pElem void criarpilha struct Pilha p int c ptopo 1 pcapa c ppElem float malloc c sizeoffloat int estavazia struct Pilha p if p topo 1 return 1 true else return 0 false int estacheia struct Pilha p if ptopo pcapa 1 return 1 else return 0 void empilhar struct Pilha p float v ptopo ppElem ptopo v float desempilhar struct Pilha p float aux ppElem ptopo ptopo return aux float retornatopo struct Pilha p return ppElem ptopo int main struct Pilha minhapilha int capacidade op float valor printf Capacidade da pilha scanf d capacidade criarpilha minhapilha capacidade Trabalho Continuação do códigos dos exemplos de pilha while 1 loop infinito printf 1 empilhar push printf2 desempilhar POP printf3 Mostrar o topo printf4 sair printfnopcao scanfd op switch op case 1 push if estacheia minhapilha 1 printf PILHA CHEIA else printf VALOR scanff valor empilhar minhapilha valor break case 2 pop if estavaziaminhapilha 1 printf PILHA VAZIA else valor desempilhar minhapilha printf 1f DESEMPILHADO valor break case 3 mostrar o topo if estavazia minhapilha 1 printf PILHA VAZIA else valor retornatopo minhapilha printf TOPO 1fn valor break case 4 exit0 default printf OPCAO INVALIDA
Send your question to AI and receive an answer instantly
Recommended for you
Preview text
Trabalho Criar e fazer rodar os códigos dos exemplos de pilha include struct Pilha int topo posição elemento topo int capa float pElem void criarpilha struct Pilha p int c ptopo 1 pcapa c ppElem float malloc c sizeoffloat int estavazia struct Pilha p if p topo 1 return 1 true else return 0 false int estacheia struct Pilha p if ptopo pcapa 1 return 1 else return 0 void empilhar struct Pilha p float v ptopo ppElem ptopo v float desempilhar struct Pilha p float aux ppElem ptopo ptopo return aux float retornatopo struct Pilha p return ppElem ptopo int main struct Pilha minhapilha int capacidade op float valor printf Capacidade da pilha scanf d capacidade criarpilha minhapilha capacidade Trabalho Continuação do códigos dos exemplos de pilha while 1 loop infinito printf 1 empilhar push printf2 desempilhar POP printf3 Mostrar o topo printf4 sair printfnopcao scanfd op switch op case 1 push if estacheia minhapilha 1 printf PILHA CHEIA else printf VALOR scanff valor empilhar minhapilha valor break case 2 pop if estavaziaminhapilha 1 printf PILHA VAZIA else valor desempilhar minhapilha printf 1f DESEMPILHADO valor break case 3 mostrar o topo if estavazia minhapilha 1 printf PILHA VAZIA else valor retornatopo minhapilha printf TOPO 1fn valor break case 4 exit0 default printf OPCAO INVALIDA