Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef struct {int jour;int mois;int annee;}date;
- typedef struct {char nomfich[15];long taille; date datecreation;}infofich;
- typedef struct elt{infofich info; struct elt *svt;} fichier;
- typedef struct eltr{char nom_rep[15]; char sous_rep1[15]; char sous_rep2[15]; struct elt *lien;}rep;
- typedef struct eltl{rep info; struct eltl *next;} liste;
- fichier *creation(int m)
- { fichier *q,*T=NULL; int j=0;
- for(j=0;j
- { q=(fichier *)malloc(sizeof(fichier)); printf("entrez le contenue du fichier: nom,taille \n");
- scanf("%s %ld",q->info.nomfich,&q->info.taille);
- printf("entrez la date de creation du fichier:jj,mm,AAAA\n");
- scanf("%d %d %d ",&q->info.datecreation.jour,&q->info.datecreation.mois,&q->info.datecreation.annee);
- q->svt=T; T=q;} return(T);}
- liste *creat_rep(int n)
- { liste *tete=NULL,*p; int i,m;
- for (i=0;i
- { p=(liste *)malloc(sizeof(liste)); printf("entrez le nom du repertoire et des sous repertoires \n");
- scanf("%s %s %s",p->info.nom_rep,p->info.sous_rep1,p->info.sous_rep2);
- p->next=tete; tete=p;
- printf("entrez le nombre de fichier dans ce repertoire \n"); scanf("%d",&m);
- p->info.lien=creation(m); } return(tete); }
- void affichage(liste *tete,char *ch)
- { liste *p,*r; fichier *q;
- for(p=tete;p!=NULL &&(strcmp(p->info.nom_rep,ch)!=0) ;r=p,p=p->next)
- if (p==NULL) printf("ce repertoire n'existe pas \n");
- printf("%s %s %s",(r->next)->info.nom_rep,(r->next)->info.sous_rep1,(r->next)->info.sous_rep2);
- for(q=(r->next)->info.lien;q!=NULL;q=q->svt)
- printf("%s %ld la date de creation est: %d %d %d",q->info.nomfich,q->info.taille,q->info.datecreation.jour,q->info.datecreation.mois,q->info.datecreation.annee);
- }
- int main()
- { liste *tete=NULL,*p; fichier *q,*r; int n; char ch[15];
- printf("combien de repertoire voulez-vous crée ?? \n"); scanf("%d",&n);
- tete=creat_rep(n);
- printf("entrez le nom du repertoire que vous voulez afficher \n"); scanf("%s",ch);
- affichage(tete,ch); return 0;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement