Acasa Tehnologie Coada – creare

Coada – creare

by Dragos Schiopu

>

#include <iostream.h>
#include <conio.h>
#include <alloc.h>
#include <string.h>

typedef struct coada
{
char nume[20];
struct coada *next;
};

coada *c, *prim;

void init()
{
coada *aux;
c=(coada *)sizeof(coada);
c->next=NULL;
prim->next=c;
aux=(coada *)sizeof(coada);
strcpy(aux->nume,"aa");
aux->next=NULL;
c->next=aux;
aux=(coada *)sizeof(coada);
strcpy(aux->nume,"bb");
aux->next=NULL;
c->next=aux;

}


void afis()
{
coada *a;
a=prim->next;

while(a->next!=NULL)
{
cout<<a->nume;
a=a->next;
}
}

void main()
{
init();
afis();
getch();
}

s-ar putea sa-ti placa