PILHAS em C++

6 respostas
U

Ow povo, tamu precisanu di algum exercicio que envolva PILHA e de preferencia que seja resolvido, se alguem tiver por favor, mandem pra genti ver se ajuda num trabalho que estamos montando aqui na Universidade…

valew
abraçu pra td mundu ae

fuiz

6 Respostas

Kknd

USP:
Ow povo, tamu precisanu di algum exercicio que envolva PILHA e de preferencia que seja resolvido, se alguem tiver por favor, mandem pra genti ver se ajuda num trabalho que estamos montando aqui na Universidade…

valew
abraçu pra td mundu ae

fuiz

Ei, conselho.:

Vai em algum fórum de C++ e repita essa mensagem, em português!

Se quiser algum lugar que já tenha mastigado: http://www.vivaolinux.com.br/ , na seção de Scripts tem, é só procurar.

josenaldo

Enquete: Qual dos erros abaixos tornam o pedido merecedor de uma bela macumba ou algo do gênero:

a) Pedir trabalho de faculdade no GUJ

b) Pedir trabalho em C++, num forum sobre Java

c) Falar em Miguxês

Fala sério… rsrrs Moderador, pelo amor de Deus, BLOQUEIA!!!

Gabriel

www.google.com.br

Conhece mixugo?

L

Todas Alternativas ACIMA kkkkkkkkkkkkkkkkkkkkkkk
kkkkkkkkkkkkkkk
miguxes foi foda kkkkkk

cassio

http://www.submarino.com.br/books_productdetails.asp?Query=ProductPage&ProdTypeId=1&ProdId=180970&ST=SF16679

T

Se procurar em msdn.microsoft.com vai achar um monte de exemplos resolvidos. Dê uma olhada rapidinho, que vou bloquear este tópico.
Nem me pergunte se você entendeu alguma coisa.

// StackTopEmpty.cpp
// compile with: /EHsc
// Illustrates how to use the top function to
// retrieve the last element of the controlled
// sequence. It also illustrates how to use the
// empty function to loop though the stack.
// 
// Functions:
//
//    top   :  returns the top element of the stack.
//    empty :  returns true if the stack has 0 elements.
//////////////////////////////////////////////////////////////////////

#pragma warning(disable:4786)
#include <stack>
#include <iostream>

using namespace std ;

typedef stack<int> STACK_INT;

int main()
{
   STACK_INT stack1;

   cout &lt&lt "stack1.empty() returned " &lt&lt
      (stack1.empty()? "true": "false") &lt&lt endl;  // Function 3

   cout &lt&lt "stack1.push(2)" &lt&lt endl;
   stack1.push(2);

   if (!stack1.empty())                           // Function 3
      cout &lt&lt "stack1.top() returned " &lt&lt
      stack1.top() &lt&lt endl;                       // Function 1

   cout &lt&lt "stack1.push(5)" &lt&lt endl;
   stack1.push(5);

   if (!stack1.empty())                           // Function 3
      cout &lt&lt "stack1.top() returned " &lt&lt
      stack1.top() &lt&lt endl;                       // Function 1

   cout &lt&lt "stack1.push(11)" &lt&lt endl;
   stack1.push(11);

   if (!stack1.empty())                           // Function 3
      cout &lt&lt "stack1.top() returned " &lt&lt
      stack1.top() &lt&lt endl;                       // Function 1

   // Modify the top item. Set it to 6.
   if (!stack1.empty()) {                         // Function 3
      cout &lt&lt "stack1.top()=6;" &lt&lt endl;
      stack1.top()=6;                             // Function 1
   }

   // Repeat until stack is empty
   while (!stack1.empty()) {                      // Function 3
      const int& t=stack1.top();                  // Function 2
      cout &lt&lt "stack1.top() returned " &lt&lt t &lt&lt endl;
      cout &lt&lt "stack1.pop()" &lt&lt endl;
      stack1.pop();
   }
}
Criado 28 de maio de 2007
Ultima resposta 29 de mai. de 2007
Respostas 6
Participantes 7