aminasmile  | re Bonjour      
 j'ai un exercice et le principe c'est : on a une liste de livre emprunté par des étudiants dans une prériode de temps :  bon il nous demande de déclarer la structure  et puis voir si un livre donnée et emprunté par l'un des étudiants : j'ai rédigé le programme je compile (sans erreur) mais avec des bugs dans le premier niveau après  rien d'autre s'affiche !!
  Code :
 - #include<stdio.h>
 - #include<stdlib.h>
 - #include<string.h>
 - struct cellule{
 - char Prenom[10];
 - int jd; \\jour de début de la période
 - int jf; \\fin de la prériode
 - struct cellule * next;
 - };
 - typedef struct cellule* etudiant;
 - struct cel{
 - char titre[20];
 - etudiant petudiant;
 - struct cel * suiv;
 - };
 - typedef struct cel* livre;
 - etudiant creer(char P[],int j1, int j2)
 - {
 -  etudiant debut= NULL, nouveau ;
 -  nouveau=malloc(sizeof(struct cellule));
 -  strcpy(nouveau->Prenom,P);
 -  nouveau->jd=j1;
 -  nouveau->jf=j2;
 -  nouveau->next=debut;
 -  nouveau=debut;
 -   return debut ;
 - }
 - livre suite(char N[],etudiant pet){
 - livre begin = NULL, nouveau ;
 -  nouveau=malloc(sizeof(struct cel));
 -  strcpy(nouveau->titre,N);
 -  nouveau->petudiant=pet;
 -  nouveau->suiv=begin;
 -  nouveau=begin;
 -   return begin ;
 - }
 - void afficher(livre l)
 - {livre p ;
 - for(p=l;p!=NULL;p=p->suiv){
 -     printf("le titre du livre est %d\n" ,p->titre);
 - }
 - }
 - int trouver( livre l ,int j, char Nom[])
 - { livre p=l; etudiant q;
 - while(p!=NULL && strcmp(p->titre,Nom)!=0)
 - {
 - p=p->suiv;
 - }
 - if(p=NULL) return 0;
 - else q=p->petudiant;
 - while(q!=NULL){
 - if(j>=q->jd&&j<=q->jf) return 1 ;
 - q=q->next;
 - }
 - return 0;
 - }
 - void main()
 - {
 - int n,b,c;
 -  int i ,J;
 -  char titro[10];
 -  char nomet[10];
 -  livre L, LL;
 -  etudiant et;
 - printf("saisir n\n" );
 - scanf("%d,&n" );
 - for(i=0;i<n;i++){
 - printf("entrer le titre du livre:\n" );
 - gets(titro);
 - printf("entrer nom d'étudiant \n" );
 - gets(nomet);
 - printf("entrer jour debut \n" );
 - scanf("%d",&c);
 - printf("entre jour fin \n" );
 - scanf("%d",&b);
 - }
 - L= creer(nomet,c,b);
 - LL=suite(titro,et);
 - afficher(L);
 - printf(" l'emprunte du livre est %d\n",trouver(L,J,titro));
 - system("pause" );
 - }
 
  |  
    merci d'avance ...       |