Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream.h>
- #include<fstream.h>
- typedef struct nod{
- int inf;
- nod *urm;
- }AD; //descrierea unui element din lista
- AD *L[N]; //listele vecinilor
- void citire()
- {
- int i,j; AD *x;
- ifstream f(βin.txtβ);
- f>>n; //numarul de varfuri
- for(i=1;i<=n;i++) //aloca adrese pentru listele vecinilor
- {
- L[i]=new AD; L[i]->urm=0;
- }
- while(!feof(f))
- {
- f>>i>>j;
- //adaug j in lista vecinilor lui i
- x=new AD; x->inf=j; x->urm=L[i]->urm; L[i]->urm=x;
- }
- fclose(f);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement