1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
# include <stdio.h>
# define dim 50
struct etudiant {
char mat[12];
char nom[12];
char pren[12];
char adr[13];
};
typedef struct etudiant etd;
void etud_regist(etd T[dim],int n)
{
int i;
printf("Donnez le nombre d eleve : ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("donnez le matricule d eleve %d : ",i+1);
scanf("%s",T[i].mat);
printf("donnez le nom d eleve %d : ",i+1);
scanf("%s",T[i].nom);
printf("donnez le prenom d eleve %d : ",i+1);
scanf("%s",T[i].pren);
printf("donnez le adresse d eleve %d : ",i+1);
scanf("%s",T[i].adr);
}
}
void etud_affich(etd T[dim],int n)
{
int i;
for(i=0;i<n;i++)
{
printf("le matricule d eleve %d : %s `\n",i+1,T[i].mat);
printf("le nom d eleve %d : %s \n",i+1,T[i].nom);
printf("le prenom d eleve %d : %s \n",i+1,T[i].pren);
printf("le adresse d eleve %d : %s \n",i+1,T[i].adr);
}
}
int main(void)
{
int n;
etd T[dim];
etud_regist(T,n);
etud_affich(T,n);
return 0;
} |
Partager