ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Codigo de pila


Enviado por   •  16 de Noviembre de 2015  •  Apuntes  •  1.669 Palabras (7 Páginas)  •  114 Visitas

Página 1 de 7

#in#include

#include

using namespace std;

struct nodo

{

        char dato;

        struct nodo * enlace;

};

int main ()

{

        typedef struct nodo lista;

        lista*inicio=NULL, *auxiliar=NULL;

        char resp, elemento;

        system("cls");

        do

        {

                cout<<"\nDesea crea un nodo [S/N] "<

                resp=getche();

                resp=toupper(resp);

                if(resp=='S')

                {

                        cout<<"\nDa el dato"<

                        elemento=getche();

                        if(inicio==NULL)

                        {

                                inicio=new lista;

                                if(inicio!=NULL)

                                {

                                        inicio->dato=elemento;

                                        inicio->enlace=NULL;

                                }

                        }

            }

           

                        else

                        {

                                auxiliar=new lista;

                                cout<

                                if(auxiliar!=NULL)

                                {

                                        auxiliar->dato=elemento;

                                        auxiliar->enlace=inicio;

                                        inicio=auxiliar;

                                }

                        }

                

        }while(resp=='S');

                if(inicio==NULL)

                {

                        cout<<"\nLista vacia "<

...

Descargar como (para miembros actualizados)  txt (3 Kb)   pdf (25 Kb)   docx (10 Kb)  
Leer 6 páginas más »
Disponible sólo en Clubensayos.com