Etudes/C/Premiere annee/structureClub/biblio.c

40 lines
1.0 KiB
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "biblio.h"
typeAdherent *nouvelAdherent(){
typeAdherent *adherent;
adherent = (typeAdherent*) malloc(sizeof(typeAdherent));
printf("Nom: ");
scanf("%s", adherent->nom);
printf("Prenom: ");
scanf("%s", adherent->prenom);
printf("Numero de badge: ");
scanf("%s", adherent->numCarte);
printf("Numero d'activite: ");
scanf("%u", &adherent->numActivite);
printf("\nVous êtes incrit.\n\n");
return adherent;
}
void afficherUnAdherent(typeAdherent *adherent[], char numCarteAdherent[], int nbAdherent){
int boucle;
for(boucle = 0; boucle < nbAdherent; boucle++){
if(strcmp(adherent[boucle]->numCarte, numCarteAdherent) == 0){
printf("Nom: ");
printf("%s\n", adherent[boucle]->nom);
printf("Prenom: ");
printf("%s\n", adherent[boucle]->prenom);
printf("Numero d'activite: ");
printf("%u\n\n", adherent[boucle]->numActivite);
}
}
}