Ejemplo De Multilistas En C++
1.Ingresar un grupo
2. Ingresar un codigo de un estudiante
3. Eliminar un grupo
4. Eliminar codigo de un estudiante
5. Mostrar grupos
6. Mostrar codigos de estudiantes
7. Mostrar gruposy codigos de los estudiantes
8. Salir
#include
#include
using namespace std;
class Secundario
{
public:
Secundario *s;
int dato;
};
class Principal
{
public:Secundario *sec;
Principal *s;
int dato;
};
Principal *crear(Principal *cab, int x)
{
Principal *nuevo;
nuevo = new Principal;
nuevo->dato = x;
nuevo->s = NULL;
nuevo->sec = NULL;cab = nuevo;
}
void insertar_grupo(Principal *cab, int x)
{
Principal* temp, *nuevo,*aux;
temp = cab;
aux=cab;
int c;
coutx;
while(aux!=NULL )
{
if(aux->dato==x)
{
c=4;}
aux=aux->s;
}
if(c==4)
{
coutdato > x)
{
break;
}
temp = temp->s;
}
nuevo = new Principal;
nuevo->dato = x;
nuevo->s = temp->s;
temp->s = nuevo;nuevo->sec = NULL;
}
}
void insertar_estudiante(Secundario *cab, Principal *cab1, int x, int y)
{
int c,co=0;
Principal *temp,*aux,*aux2;
Secundario *nuevo, *temp1,*aux3;
coutx;aux=cab1;
aux2=cab1;
while(aux!=NULL )
{
if(aux->dato==x)
{
c=4;
}
aux=aux->s;
}
if(c!=4)
{
couts;
}
if(co==1)
{
coutsec == NULL)
{temp->sec = nuevo;
cab = temp->sec;
cab->s = NULL;
}
else
{
temp1 = temp->sec;
while(temp1->s != NULL)
{
temp1 = temp1->s;
}temp1->s = nuevo;
nuevo->s = NULL;
}
}
}
}
Principal *eliminar_grupo(Principal *cab, int x)
{
if(cab==NULL)
{
couts;
}
ant->s=eli->s;...
Regístrate para leer el documento completo.