Ayuda por favor
A ver me han puesto este ejercicio:
Crear un strux para la lista enlazada (NO doblemente) que albergue la siguiente informacion en cada elemento:
nombre: vector de 60 char
edad:numero entero int
peso: numero con decimales float
Y modificar ñas funciones de gestion insertar() y extraer() para que puedan manipular esta informaicon adicional.
void insertar(struc lista **pp, long sitio, char c)
{
struct lista *nuevo;
while (((*pp) != NULL) && sitio--)
{
pp=¬((*pp)->sgte);
}
nuevo=new struc lista;
nuevo->sgte=*pp;
*pp=nuevo;
nuevo->dato=c;
}
long extraer(struc lista **pp, long sitio, char *c)
{
struct lista **xp, **vp;
struct lista *b;
long=0;
xp=pp;
while(((*xp)|=NULL) &&sitio--)
{
n++;
vp=xp;
xp=&((*xp->sgte);
}
if((*pp)|=NULL)
{
if ((*xp)==NULL)
{
n--;
xp=vp;
}
b=*xp;
*xp=(*xp)->sgte;
*c=b->dato;
delete b;
}
else { n=-1; }
return n;
}
Si alguien me ayudase a hacerlo porque ayer me tire la tarde entera y nada y lo necesito para subir nota...
Saludos y gracias.
Crear un strux para la lista enlazada (NO doblemente) que albergue la siguiente informacion en cada elemento:
nombre: vector de 60 char
edad:numero entero int
peso: numero con decimales float
Y modificar ñas funciones de gestion insertar() y extraer() para que puedan manipular esta informaicon adicional.
void insertar(struc lista **pp, long sitio, char c)
{
struct lista *nuevo;
while (((*pp) != NULL) && sitio--)
{
pp=¬((*pp)->sgte);
}
nuevo=new struc lista;
nuevo->sgte=*pp;
*pp=nuevo;
nuevo->dato=c;
}
long extraer(struc lista **pp, long sitio, char *c)
{
struct lista **xp, **vp;
struct lista *b;
long=0;
xp=pp;
while(((*xp)|=NULL) &&sitio--)
{
n++;
vp=xp;
xp=&((*xp->sgte);
}
if((*pp)|=NULL)
{
if ((*xp)==NULL)
{
n--;
xp=vp;
}
b=*xp;
*xp=(*xp)->sgte;
*c=b->dato;
delete b;
}
else { n=-1; }
return n;
}
Si alguien me ayudase a hacerlo porque ayer me tire la tarde entera y nada y lo necesito para subir nota...
Saludos y gracias.