<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content=text/html;charset=iso-8859-1>
<META content="MSHTML 6.00.6001.18226" name=GENERATOR></HEAD>
<BODY id=MailContainerBody 
style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-TOP: 15px" leftMargin=0 
topMargin=0 CanvasTabStop="true" name="Compose message area">
<DIV><FONT face=Arial size=2>Disculpa si entre tarde a la discucion, pero te 
falto poner break; despues del menu de pilas por esos pasa al menu de COLAS 
cuando vuelve de PILAS</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Saludos. Silvio.</FONT></DIV>
<DIV style="FONT: 10pt Tahoma">
<DIV><BR></DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=joev89@gmail.com 
href="mailto:joev89@gmail.com">Jose Villafaņe</A> </DIV>
<DIV><B>Sent:</B> Monday, April 27, 2009 3:50 PM</DIV>
<DIV><B>To:</B> <A title=cconclase@listas.conclase.net 
href="mailto:cconclase@listas.conclase.net">Lista de correo sobre C y C++</A> 
</DIV>
<DIV><B>Subject:</B> Re: [C con Clase] Pilas</DIV></DIV></DIV>
<DIV><BR></DIV><BR>
<DIV class=gmail_quote>
<BLOCKQUOTE class=gmail_quote 
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
  <DIV>
  <DIV class=h5>tomare en cuenta lo de las variables locales, 
  gracias!</DIV></DIV></BLOCKQUOTE>
<DIV><BR>por ahora dejo el codigo completo que hice....(es en devC++ por 
cierto)<BR><BR><BR>#include <stdio.h><BR>#include 
<conio.h><BR>#include <cstdlib><BR>#include 
<iostream><BR><BR>using namespace std;<BR><BR>void Arreglo(void);<BR>void 
Pila(void);<BR>void Cola(void);<BR>void visualizar(void);<BR>void 
insertar(void);<BR>void extraer(void);<BR>void visualizar1(void);<BR>void 
insertar1(void);<BR>void extraer1(void);<BR><BR><BR>struct 
pila<BR>{<BR>    char nombre[20];<BR>    struct 
pila *ant;<BR>}*CAB=NULL,*AUX=NULL;<BR><BR>struct 
cola<BR>{<BR>    char nombre[20];<BR>    struct 
cola *sig;<BR>}*CAB1=NULL,*AUX1=NULL,*FIN1=NULL;<BR><BR><BR>struct persona 
{<BR>           char 
nombre[20];<BR>           
float n1, n2, n3, n4, 
prom;<BR>           
<BR>           
}alumno[5];<BR><BR>int main() <BR>{<BR>    char 
opc;<BR>    do<BR>    {<BR>    
    system("cls"); <BR>        
cout << "\t \t \t \tProyecto 2: " << 
endl;<BR>        cout << 
"\n";<BR>        <BR>    
    cout << "1.- Arreglo" << 
endl;<BR>        cout << 
"\n";<BR>    <BR>        cout 
<< "2.- Pilas" << 
endl;<BR>        cout << 
"\n";    <BR>    <BR>    
    cout << "3.- Colas" << 
endl;<BR>        cout << 
"\n";<BR>        <BR>    
    cout << "4.- Salir" << 
endl;<BR>        opc=getch( 
);<BR>        switch(opc)<BR>    
    {<BR>           
 case '1':<BR>           
     Arreglo( );<BR>       
         break;<BR>    
        case 
'2':<BR>                 
Pila( );  <<=== Falta 
break;<BR>            
case 
'3':<BR>                 
Cola( );<BR>        }<BR>    }while 
(opc!='4');<BR>}<BR><BR>void Arreglo(void)<BR>{<BR>    
system("cls");<BR>    for(int i=0; i<5; 
i++)<BR>    {<BR>    cout << "\t \t \t 
\tArreglos." << endl;<BR>    cout << 
"\n";<BR>    <BR>    cout << "Nombre del 
Estudiante: ";<BR>    cin >> 
alumno[i].nombre;<BR>    cout << 
"\n";<BR>    <BR>    cout << "Nota 1: 
";<BR>    cin >> alumno[i].n1; <BR>    cout 
<<"\n";<BR>    <BR>    cout << "Nota 
2: ";<BR>    cin >> alumno[i].n2;<BR>    
cout << "\n";<BR>    <BR>    cout << 
"Nota 3: ";<BR>    cin >> 
alumno[i].n3;<BR>    cout << "\n";<BR>    
<BR>    cout << "Nota 4: ";<BR>    cin 
>> alumno[i].n4;<BR>    cout << 
"\n";<BR>    <BR>    alumno[i].prom= (alumno[i].n1 
+ alumno[i].n2 + alumno[i].n3 + alumno[i].n4)/4; <BR><BR>    cout 
<< "Promedio: " << alumno[i].prom << 
endl;<BR>    cout << "\n";<BR>    
<BR>    system("pause");<BR>    cout << 
"\n";<BR>}<BR>}<BR><BR><BR>void Pila(void)<BR>{<BR>     char 
opc;<BR>    do<BR>    {<BR>    
    system("cls"); <BR>  
<BR>        cout << "\t \t \t \tPila." 
<< endl;<BR>        cout << 
"\n";<BR>        <BR>    
    cout << "1.- Insertar" << 
endl;<BR>        cout << 
"\n";<BR>    <BR>        cout 
<< "2.- Extraer" << 
endl;<BR>        cout << 
"\n";    <BR>    <BR>    
    cout << "3.- Visualizar la pila" << 
endl;<BR>        cout << 
"\n";<BR>        <BR>    
    cout << "4.- Salir" << 
endl;<BR>        opc=getch( 
);<BR>        switch(opc)<BR>    
    {<BR>           
 case '1':<BR>           
     insertar( );<BR>       
         break;<BR>    
        case '2':<BR>    
            extraer( 
);<BR>               
 break;<BR>            case 
'3':<BR>               
 visualizar( );<BR>       
 }<BR>    }while (opc!='4');<BR>}<BR><BR>void 
insertar(void)<BR>{<BR>    AUX=(struct pila 
*)malloc(sizeof(struct pila));<BR>    
system("cls");<BR>    cout << "Nombre: 
";<BR>    gets(AUX->nombre);<BR>    if 
(CAB==NULL)<BR>    {<BR>       
 CAB=AUX;<BR>       
 AUX->ant=NULL;<BR>    }<BR>    
else<BR>    {<BR>       
 AUX->ant=CAB;<BR>       
 CAB=AUX;<BR>    }<BR>}<BR><BR>void 
extraer(void)<BR>{<BR>    if (CAB==NULL) 
return;<BR>    AUX=CAB;<BR>    
CAB=CAB->ant;<BR>    free(AUX);<BR>}<BR><BR>void 
visualizar(void)<BR>{<BR>    if (CAB==NULL) 
return;<BR>     system("cls");<BR>    
AUX=CAB;<BR>    while (AUX!=NULL)<BR>    
{<BR>        cout << "Nombre: " << 
AUX->nombre << endl;<BR>       
 AUX=AUX->ant;<BR>    }<BR>    getch( 
);<BR>}<BR><BR><BR>void Cola(void)<BR>{<BR>    char 
opc;<BR>    do<BR>    {<BR>    
    system("cls");<BR>       
 <BR>        cout << "\t \t \t 
\tColas." << endl;<BR>        cout << 
"\n";<BR>        <BR>    
    cout << "1.- Insertar" << 
endl;<BR>        cout << 
"\n";<BR>    <BR>        cout 
<< "2.- Extraer" << 
endl;<BR>        cout << 
"\n";<BR>           
 <BR>        cout << "3.- Visualizar la 
cola" << endl;<BR>        cout << 
"\n"; <BR>       
 <BR>        cout << "4.- Salir" 
<< endl;<BR>        opc=getch( 
);<BR>        switch(opc)<BR>    
    {<BR>           
 case '1':<BR>           
     insertar1( );<BR>       
         break;<BR>    
        case '2':<BR>    
            extraer1( 
);<BR>               
 break;<BR>            case 
'3':<BR>               
 visualizar1( );<BR>       
 }<BR>    }while (opc!='4');<BR>}<BR><BR>void 
insertar1(void)<BR>{<BR>    AUX1=(struct cola 
*)malloc(sizeof(struct cola));<BR>    
system("cls");<BR>    cout << "Nombre: 
";<BR>    gets(AUX1->nombre);<BR>    
AUX1->sig=NULL;<BR>    if (FIN1==NULL)<BR>    
    FIN1=CAB1=AUX1;<BR>    
else<BR>    {<BR>       
 FIN1->sig=AUX1;<BR>       
 FIN1=AUX1;<BR>    }<BR>}<BR><BR>void 
extraer1(void)<BR>{<BR>    if (CAB1==NULL) 
return;<BR>    AUX1=CAB1;<BR>    
CAB1=CAB1->sig;<BR>    free(AUX1);<BR>}<BR><BR>void 
visualizar1(void)<BR>{<BR>    if (CAB1==NULL) 
return;<BR>    system("cls");<BR>    
AUX1=CAB1;<BR>    while (AUX1!=NULL)<BR>    
{<BR>        cout << "Nombre: " << 
AUX1->nombre << endl;<BR>       
 AUX1=AUX1->sig;<BR>    }<BR>    
getch();<BR>} <BR></DIV>
<BLOCKQUOTE class=gmail_quote 
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
  <DIV>
  <DIV class=h5><BR><BR>_______________________________________________<BR>Lista 
  de correo Cconclase <A href="mailto:Cconclase@listas.conclase.net" 
  target=_blank>Cconclase@listas.conclase.net</A><BR><A 
  href="http://listas.conclase.net/mailman/listinfo/cconclase_listas.conclase.net" 
  target=_blank>http://listas.conclase.net/mailman/listinfo/cconclase_listas.conclase.net</A><BR>Bajas: 
  <A href="http://listas.conclase.net/index.php?gid=2&mnu=FAQ" 
  target=_blank>http://listas.conclase.net/index.php?gid=2&mnu=FAQ</A><BR></DIV></DIV></BLOCKQUOTE></DIV><BR>
<P>
<HR>

<P></P>_______________________________________________<BR>Lista de correo 
Cconclase 
Cconclase@listas.conclase.net<BR>http://listas.conclase.net/mailman/listinfo/cconclase_listas.conclase.net<BR>Bajas: 
http://listas.conclase.net/index.php?gid=2&mnu=FAQ</BODY></HTML>