Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --------------------------------------------------La bibliothèque tp.h------------------------------------------------------------------
- typedef enum Etat_emprunt Etat_emprunt;
- enum Etat_emprunt
- {
- rendu ,
- non_rendu
- } ;
- typedef enum Etat_livre Etat_livre;
- enum Etat_livre
- {
- disponible ,
- non_disponible
- };
- /*---------------------Les structures ----------------------------*/
- /*---------------La structure Fiche livre-------------------------*/
- typedef struct Fiche_livre Fiche_livre ;
- struct Fiche_livre
- {
- int cote ;
- char titre[100] ;
- char auteur[50] ;
- char date_edit[12] ;
- char editeur[50] ;
- char mots_clees[5][24] ;
- char resume[5000] ;
- Fiche_livre *Livre_suivant ;
- };
- /*---------------La structure Fiche emprunteur-------------------------*/
- typedef struct Fiche_emprunteur Fiche_emprunteur ;
- struct Fiche_emprunteur
- {
- char Nom[50] ;
- char Prenom[50];
- char Adresse[100] ;
- int N_tel ;
- int N_ordre ;
- char date_inscrip[12] ;
- int penalites ;
- int emprunts;
- Fiche_emprunteur *Emprunteur_suivant ;
- } ;
- /*---------------La structure Fiche emprunt-------------------------*/
- typedef struct Fiche_emprunt Fiche_emprunt;
- struct Fiche_emprunt
- {
- Fiche_emprunteur Emprunteur ;
- Fiche_livre Livre_emprunte ;
- char Date_emprunt[12] ;
- char Date_rentree[12] ;
- Etat_emprunt etat_emprunt ;
- Fiche_emprunt *Emprunt_suivant ;
- };
- /*---------------Autres---------------------------------------------*/
- void Inscription_Emprunteur(Fiche_emprunteur *E);
- ----------------------------------le Fichier c de la fonction à tester tp.c------------------------------------------------------
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h >
- #include "tp.h"
- void Inscription_Emprunteur(Fiche_emprunteur *E)
- {
- system("cls");
- printf("Veuillez introduire votre nom :");
- scanf("%s\n", (*E).Nom);
- printf("Veuillez introduire votre prenom :");
- scanf("%s\n", (*E).Prenom);
- printf("Veuillez introduire votre adresse :");
- scanf("%s\n", (*E).Adresse);
- printf("Veuillez introduire votre numero de telephone :");
- scanf("%s\n",(*E).N_tel);
- printf("Merci de votre inscription");
- system("PAUSE");
- }
- ----------------------Le programme test Prog.c-----------------------------------------------------------
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h >
- #include "tp.h"
- int main(void)
- {
- Fiche_emprunteur F ;
- Fiche_emprunteur *p= NULL ;
- p = &F ;
- p = malloc(sizeof(Fiche_emprunteur));
- Inscription_Emprunteur(p);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement