C/Visual C - SUBLISTAS C

 
Vista:

SUBLISTAS C

Publicado por oty (2 intervenciones) el 05/06/2007 12:48:28
**MENU CON 5 OPCIONES :
1.-INSERTAR RIO Y AFLUENTES.
(VAMOS A CARGAR RIO, LUEGO AFLUENTES)
2.-LISTAR TODOS LOS RIOS CON SUS AFLUENTES.
3.-BORRAR RIO O AFLUENTE.
4.-CONSULTAR LOS AFLUENTES DE UN RIO.
5.-FIN

Estoy un poco estancado con este ejercicio.Alguien me podria echar una manilla ?
Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:SUBLISTAS C

Publicado por Nelek (816 intervenciones) el 05/06/2007 14:12:28
Y donde exactamente te has estancado? Al leer el enunciado?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:SUBLISTAS C

Publicado por oty (2 intervenciones) el 11/06/2007 10:31:20
Estoy estancado en la letra Menu :D

En la parte de borrar nose muy bien como hacerlo. Aqui esta mi codigo, la estructura y el borrado. Introducir datos está bien, ahora me queda el borrado. Gracias

struct afluente { // Sublista
char nombreafluente[50];
struct afluente *ssig; //Puntero al subnodo siguiente
};

struct rio { // lista
char nombrerio[50];
struct rio *nsig; // Nodo siguiente
struct afluente *psub; //puntero a la sublista
};

struct rio *iniciolista=NULL,*nuevolista,*anteriorlista;
struct afluente *iniciosub=NULL, *nuevosub, *anteriorsub;

//Borrar

nuevolista = iniciolista;
char dato[50];
puts ("\n\nIntroduce dato a borrar");
scanf ("%s", &dato);
while (nuevolista != NULL)
{
if (dato == nuevolista -> nombrerio)
{
if (nuevolista == iniciolista) // ALGORITMO BORRADO
nuevolista = iniciolista -> nsig;
else
{
iniciolista = iniciolista -> nsig;
free (nuevolista); } // TERMINA ALGORITMO BORRADO
}
else
{ nuevolista = nuevolista -> nsig; }

}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar