{
sacarAluNom(n,q);
sacarAluMatri(m,q);
sacarAluAnio(a,q);
sacarMaterias(q->alu.aprobadas);
delete q;
}
else
cout<<"No se encontro la matricula"<<endl;
}
void listar(puntAlumno&lisGral,char orden)
{
puntAlumno r=lisGral;
while(r!=NULL)
{
cout<<"Nombre: "<<r->alu.nombre<<" matricula: "<<r->alu.matricula<<" ao que cursa
: "<<r->alu.anio<<endl;
cout<<"Materias aprobadas del alumno: "<<endl;
listarMateApro(r->alu.aprobadas);
switch(orden)
{
case 'n':
{
r=r->sigNombre;
break;
}
case 'm':
{
r=r->sigMatricula;
break;
}
case 'a':
{
r=r->sigAnio;
break;
}
}
}
}
void buscar(puntAlumno&m,puntAlumno&q,int matri)
{
puntAlumno r=m;
while((r!=NULL)&&(r->alu.matricula!=matri))
r=r->sigMatricula;
if(r->alu.matricula==matri)
q=r;
}
void agregarAluNom(puntAlumno&n,alumno dato)
{
puntAlumno r,ant,nuevo;
ant=NULL;
r=n;
if(n==NULL)
{
nuevo=new nodoAlumno;
nuevo->alu=dato;
nuevo->sigNombre=NULL;
n=nuevo;
}
else
{
int compara=strcmp(r->alu.nombre,dato.nombre); //menor a 0,en el dicc 1ero esta
r->.... y mayor a 0, aparece 1ero
//dato.nombre
while((r!=NULL)&&(compara<0))
{
ant=r;
r=r->sigNombre;
compara=strcmp(r->alu.nombre,dato.nombre);
}
nuevo=new nodoAlumno;
nuevo->alu=dato;
if(r==n)
{
nuevo->sigNombre=n;
n=nuevo;
}
else
{
ant->sigNombre=nuevo;
nuevo->sigNombre=r;
}
}
}
void agregarAluMatri(puntAlumno&m,alumno dato)
{
puntAlumno r,ant,nuevo;
ant=NULL;
r=m;
if(m==NULL)
{
nuevo=new nodoAlumno;
nuevo->alu=dato;
nuevo->sigNombre=NULL;
m=nuevo;
}
else
{
while((r!=NULL)&&(r->alu.matricula<dato.matricula))
{
ant=r;
r=r->sigMatricula;
}
nuevo=new nodoAlumno;
nuevo->alu=dato;
if(r==n)
{
nuevo->sigNombre=m;
m=nuevo;
}
else
{
ant->sigMatricula=nuevo;
nuevo->sigMatricula=r;
}
}
}
void agregarAluAnio(puntAlumno&a,alumno dato)
{
puntAlumno r,ant,nuevo;
ant=NULL;
r=a;
if(a==NULL)
{
nuevo=new nodoAlumno;
nuevo->alu=dato;
nuevo->sigNombre=NULL;
a=nuevo;
}
else
{
while((r!=NULL)&&(r->alu.anio<dato.anio))
{
ant=r;
r=r->sigAnio;
}
nuevo=new nodoAlumno;
nuevo->alu=dato;
if(r==n)
{
nuevo->sigNombre=a;
a=nuevo;
}
else
{
ant->sigAnio=nuevo;
nuevo->sigAnio=r;
}
}
}
void sacarAluNom(puntAlumno&n,puntAlumno&q)
{
puntAlumno r,ant;
r=n;
ant=NULL;
while((r!=NULL)&&(r!=q))
{
ant=r;
r=r->sigNombre;
}
if(r!=NULL)
{
if(r==n)
n=r->sigNombre;
else
ant->sigNombre=r->sigNombre;
}
}
void sacarAluMatri(puntAlumno&m,puntAlumno&q)
{
puntAlumno r,ant;
r=m;
ant=NULL;
while((r!=NULL)&&(r!=q))
{
ant=r;
r=r->sigMatricula;
}
if(r!=NULL)
{
if(r==m)
n=r->sigMatricula;
else
ant->sigMatricula=r->sigMatricula;
}
}
void sacarAluAnio(puntAlumno&a,puntAlumno&q)
{
puntAlumno r,ant;
r=a;
ant=NULL;
while((r!=NULL)&&(r!=q))
{
ant=r;
r=r->sigAnio;
}
if(r!=NULL)
{
if(r==a)
n=r->sigAnio;
else
ant->sigAnio=r->sigAnio;
}
}
void sacarMaterias(puntMaterias&entMat)
{
puntMaterias p;
while(entMat!=NULL)
{
p=entMat;
entMat=entMat->sig;
delete p;
}
}
void listarMateApro(puntMaterias&entMat)
{
puntMaterias r;
r=entMat;
while(r!=NULL)
{
cout<<"Codigo de materia"<<r->mat.codigo<<" nombre: "<<r->mat.nombre<<" Nota: "<
<r->nota<<endl;
r=r->sig;
}
}
------------------------------------------------------------------Muchisimas gracias!!!
Cecilia
Valora esta pregunta
Me gusta: Est pregunta es til y esta clara
No me gusta: Est pregunta no esta clara o no es til
0Responder
informacinOtras secciones de LWP con contenido de C/Visual C
- Cdigo fuente de C/Visual C
- Cursos de C/Visual C
- Temas de C/Visual C
informacinCdigos de C/Visual C
- Grficos en C
- Editor de texto
- Saber si un ao es bisiesto
Ayuuudaaa!! (C ) Multilistas
Publicado por caleb (1 intervencin) el 15/03/2011 21:18:55
bueno,
puntAlumno nuevo= new nodoAlumno;
son dos tipos de datos diferentes.
para que funcione correctamente deberia ser.
nodoAlumno *nuevo= new nodoAlumno;
pero esto ya ocacionaria, cambiar algunas lineas de codigo...
para que tengas un buen concepto de Estructura De Datos(EDD)...
te recomiendo.. bajarte un buen curso de...
te descargas "Curso EDD" est en pdf.
http://c.conclase.net/?id=descargas
o bien EDD online.
ENLACES ALTERNATIVOS
http://www.programacionfacil.com/estructura_datos_csharp/listas_enlazadas
http://www.beg.utexas.edu/agi/mod12/applet/symantec/itools/awt/MultiList.java
http://solocodigo.com/29486/solucion-para-multilistas/
http://solocodigo.com/40648/vector-de-punteros-multilista/
http://decsai.ugr.es/~jfv/ed1/tedi/cdrom/docs/m-listas.html
http://www.forosdelweb.com/1295783-post25.html