Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Cool Colas
Cool Colas
#include
#include
#include
<stdio.h>
<conio.h>
<stdlib.h>
<string.h>
struct agenda
{
char nombre[50];
char telefono[25];
char mail[50];
};
struct nodo
{
struct agenda dato;
struct nodo *proximo;
};
struct nodo *nuevonodo();
int colavacia(struct nodo *);
struct nodo *creacola(struct nodo *, struct agenda);
void mostrar(struct nodo *);
void main()
{
struct nodo *pri=NULL, *ult=NULL;
struct agenda x;
printf("Ingrese nombre: ");
gets(x.nombre);
while(strcmpi(x.nombre,"fin"))
{
printf("Ingrese telefono: ");
gets(x.telefono);
printf("Ingrese mail: ");
gets(x.mail);
ult=creacola(ult,x);
if(pri==NULL) pri=ult; // Si es la 1 pasada pongo en pri el valor del pri
mer nodo
printf("Ingrese nombre: ");
gets(x.nombre);
}
if(colavacia(pri)==1) { printf("No se ingresaron registros"); getch(); }
else mostrar(pri);
}
struct nodo *nuevonodo()
{
struct nodo *p;
p=(struct nodo *)malloc(sizeof(struct nodo));
if(p==NULL)
{
printf("Memoria RAM Llena");
getch();
exit(0);
}
return p;
}
struct nodo *creacola(struct nodo *ult, struct agenda x)
{