Essays.club - Ensayos gratis, notas de cursos, notas de libros, tareas, monografías y trabajos de investigación
Buscar

Codigo multilistas en c++

Enviado por   •  18 de Diciembre de 2018  •  1.975 Palabras (8 Páginas)  •  770 Visitas

Página 1 de 8

...

cab=nuevo;

nuevo->nombre=nombre;

nuevo->id=id;

nuevo->sigSede=NULL;

ultimo=nuevo;

}else{

ultimo->sigSede=nuevo;

nuevo->nombre=nombre;

nuevo->id=id;

nuevo->sigSede=NULL;

ultimo=nuevo;

}

}

void Lista::mostrarSedes(){

system("cls");

Sede *aux = cab;

bool bandera = true;

if(aux == NULL){

setColor(4);

cout<<"Lista vacia "<<endl<<endl;

bandera=false;

}

if(bandera==true){

cout<<"---------------------------------------------------------------"<<endl<<endl;

while(aux != NULL){

setColor(10);

cout<<"nombre: "<<aux->nombre<<" "<<"id: "<<aux->id<<" "<<endl;

aux=aux->sigSede;

}

cout<<"\n-------------------------------------------------------------"<<endl<<endl;

}

}

void Lista::mostrarTodo(){

system("cls");

int x=3;

int y=3;

Sede *aux = cab;

Categoria *aux1 = NULL;

Libro *aux2=NULL;

bool bandera=true;

if(cab == NULL){

setColor(4);

cout<<"lista vacia "<<endl<<endl;

bandera=false;

}

if(bandera==true){

while(aux != NULL){

aux1=aux->cabCategoria;

setColor(12);

cout<<"\n-----------------------------------------------------------------------------------------------------"<<endl;

cout<<" nombre de la sede: "<<aux->nombre<<endl<<endl;

while(aux1 != NULL){

aux2=aux1->cabLibro;

setColor(14);

cout<<" Categoria: "<<aux1->nombre<<endl<<endl;

while(aux2 != NULL){

setColor(9);

cout<<" nombre del libro: "<<aux2->nombre<<" ID: "<<aux2->id<<endl;

aux2=aux2->sig;

}

aux1=aux1->sig;

cout<<endl;

}

aux=aux->sigSede;

}

}

}

void Lista::eliminarSede(int id){

Sede *aux=cab;

Sede *anterior=NULL;

Categoria *opc=NULL;

string nombre;

if(aux->id == id && aux->sigSede == NULL){

nombre=aux->nombre;

if(aux->cabCategoria != NULL){

opc=aux->cabCategoria;

while(opc->sig != NULL){

opc=opc->sig;

}

delete opc;

}

cab=NULL;

setColor(12);

cout<<"\nse elimino la sede "<<nombre<<endl<<endl;

}else if(aux->id == id && aux->sigSede != NULL){

cab=aux->sigSede;

nombre=aux->nombre;

if(aux->cabCategoria != NULL){

opc=aux->cabCategoria;

while(opc->sig !=NULL){

opc=opc->sig;

}

delete opc;

}

setColor(12);

cout<<"\nse elimino la sede "<<nombre<<endl<<endl;

}else{

while(aux != NULL && aux->id != id){

anterior=aux;

aux=aux->sigSede;

}

if(aux != NULL){

anterior->sigSede=aux->sigSede;

nombre=aux->nombre;

if(aux==ultimo){

ultimo=anterior;

...

Descargar como  txt (19.4 Kb)   pdf (69.7 Kb)   docx (25.6 Kb)  
Leer 7 páginas más »
Disponible sólo en Essays.club