Advertisement
SofiaAdt

Untitled

Mar 30th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.55 KB | None | 0 0
  1. --------------------------------------------------La bibliothèque tp.h------------------------------------------------------------------
  2. typedef enum Etat_emprunt Etat_emprunt;
  3. enum Etat_emprunt
  4. {
  5.     rendu ,
  6.     non_rendu
  7. } ;
  8.  
  9. typedef enum Etat_livre Etat_livre;
  10. enum Etat_livre
  11. {
  12.     disponible ,
  13.     non_disponible
  14. };
  15. /*---------------------Les structures ----------------------------*/
  16. /*---------------La structure Fiche livre-------------------------*/
  17. typedef struct Fiche_livre Fiche_livre ;
  18. struct Fiche_livre
  19. {
  20.     int cote ;
  21.     char titre[100] ;
  22.     char auteur[50] ;
  23.     char date_edit[12] ;
  24.     char editeur[50] ;
  25.     char mots_clees[5][24] ;
  26.     char resume[5000] ;
  27.     Fiche_livre *Livre_suivant ;
  28.  
  29. };
  30.  
  31. /*---------------La structure Fiche emprunteur-------------------------*/
  32. typedef struct Fiche_emprunteur Fiche_emprunteur ;
  33. struct Fiche_emprunteur
  34. {
  35.     char Nom[50] ;
  36.     char Prenom[50];
  37.     char Adresse[100] ;
  38.     int N_tel ;
  39.     int N_ordre ;
  40.     char date_inscrip[12] ;
  41.     int penalites ;
  42.     int emprunts;
  43.     Fiche_emprunteur *Emprunteur_suivant ;
  44. } ;
  45.  
  46.  
  47. /*---------------La structure Fiche emprunt-------------------------*/
  48. typedef struct Fiche_emprunt Fiche_emprunt;
  49. struct Fiche_emprunt
  50. {
  51.     Fiche_emprunteur Emprunteur ;
  52.     Fiche_livre Livre_emprunte ;
  53.     char Date_emprunt[12] ;
  54.     char Date_rentree[12] ;
  55.     Etat_emprunt etat_emprunt ;
  56.     Fiche_emprunt *Emprunt_suivant ;
  57. };
  58. /*---------------Autres---------------------------------------------*/
  59.  
  60.  
  61. void Inscription_Emprunteur(Fiche_emprunteur *E);
  62.  
  63.  
  64. ----------------------------------le Fichier c de la fonction à tester tp.c------------------------------------------------------
  65.  
  66. #include <stdio.h>
  67. #include <stdlib.h>
  68. #include <string.h >
  69. #include "tp.h"
  70.  
  71. void Inscription_Emprunteur(Fiche_emprunteur *E)
  72. {
  73.     system("cls");
  74.     printf("Veuillez introduire votre nom :");
  75.     scanf("%s\n", (*E).Nom);
  76.     printf("Veuillez introduire votre prenom :");
  77.     scanf("%s\n", (*E).Prenom);
  78.     printf("Veuillez introduire votre adresse :");
  79.     scanf("%s\n", (*E).Adresse);
  80.     printf("Veuillez introduire votre numero de telephone :");
  81.     scanf("%s\n",(*E).N_tel);
  82.     printf("Merci de votre inscription");
  83.     system("PAUSE");
  84.    
  85. }
  86.  
  87. ----------------------Le programme test Prog.c-----------------------------------------------------------
  88.  
  89. #include <stdio.h>
  90. #include <stdlib.h>
  91. #include <string.h >
  92. #include "tp.h"
  93.  
  94.  
  95. int main(void)
  96. {
  97.     Fiche_emprunteur F ;
  98.     Fiche_emprunteur *p= NULL ;
  99.     p = &F ;
  100.     p = malloc(sizeof(Fiche_emprunteur));
  101.     Inscription_Emprunteur(p);
  102.     return 0;
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement