Typedef "structure"
mb42
Messages postés
553
Statut
Membre
-
Pilow Messages postés 410 Statut Membre -
Pilow Messages postés 410 Statut Membre -
Bonjour,
le code suivant est executable
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
struct adresse
{int num;
char rue[50];
int codepostal;
char ville[50];
};
struct date
{int jour;
int mois;
int anne;
};
struct fiche
{
char nom[50];
char prenom[50];
int telephonne;
struct adresse ad;
struct date da;
};
typedef struct fiche H;
void lirefiche(H *F)
{
printf("donner le nom :");
scanf("%s",F->nom);
printf("donner le prenom :");
scanf("%s",F->prenom);
printf("donner num :");
scanf("%d",&F->ad.num);
printf("donner le codepostale :");
scanf("%d",&F->ad.codepostal);
printf("donner rue :");
scanf("%s",F->ad.rue);
printf("donner la ville :");
scanf("%s",F->ad.ville);
printf("donner la date :");
scanf("%d%d%d",&F->da.jour,&F->da.mois,&F->da.anne);
}
void Affich_fiche(H F)
{
printf("le nom est %s ",F.nom);
printf("\nle prenom est %s",F.prenom);
printf("\nle num est %d ",F.ad.num);
printf("\nle codepostal est %d",F.ad.codepostal);
printf("\nle rue est %s ",F.ad.rue);
printf("\nla ville est %s",F.ad.ville);
printf("\nla date(jour,mois,anné) est %d %d %d",F.da.jour,F.da.mois,F.da.anne);
}
void main()
{
H F;
lirefiche(&F);
Affich_fiche(F);
getch();
}
je veux faire une petite modification avec l'utilisation de typedef
mais ca marche pas
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
typedef struct
{int num;
char rue[50];
int codepostal;
char ville[50];
}ad;
typedef struct
{int jour;
int mois;
int anne;
}da;
typedef struct
{
char nom[50];
char prenom[50];
int telephonne;
struct adresse ad;
struct date da;
}H;
void lirefiche(H *F)
{
printf("donner le nom :");
scanf("%s",F->nom);
printf("donner le prenom :");
scanf("%s",F->prenom);
printf("donner num :");
scanf("%d",&F->ad.num);
printf("donner le codepostale :");
scanf("%d",&F->ad.codepostal);
printf("donner rue :");
scanf("%s",F->ad.rue);
printf("donner la ville :");
scanf("%s",F->ad.ville);
printf("donner la date :");
scanf("%d%d%d",&F->da.jour,&F->da.mois,&F->da.anne);
}
void Affich_fiche(H F)
{
printf("le nom est %s ",F.nom);
printf("\nle prenom est %s",F.prenom);
printf("\nle num est %d ",F.ad.num);
printf("\nle codepostal est %d",F.ad.codepostal);
printf("\nle rue est %s ",F.ad.rue);
printf("\nla ville est %s",F.ad.ville);
printf("\nla date(jour,mois,anné) est %d %d %d",F.da.jour,F.da.mois,F.da.anne);
}
void main()
{
H F;
lirefiche(&F);
Affich_fiche(F);
getch();
}
pouvez vous me corriger avec l'utilisation de typedef
merci d'avance
le code suivant est executable
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
struct adresse
{int num;
char rue[50];
int codepostal;
char ville[50];
};
struct date
{int jour;
int mois;
int anne;
};
struct fiche
{
char nom[50];
char prenom[50];
int telephonne;
struct adresse ad;
struct date da;
};
typedef struct fiche H;
void lirefiche(H *F)
{
printf("donner le nom :");
scanf("%s",F->nom);
printf("donner le prenom :");
scanf("%s",F->prenom);
printf("donner num :");
scanf("%d",&F->ad.num);
printf("donner le codepostale :");
scanf("%d",&F->ad.codepostal);
printf("donner rue :");
scanf("%s",F->ad.rue);
printf("donner la ville :");
scanf("%s",F->ad.ville);
printf("donner la date :");
scanf("%d%d%d",&F->da.jour,&F->da.mois,&F->da.anne);
}
void Affich_fiche(H F)
{
printf("le nom est %s ",F.nom);
printf("\nle prenom est %s",F.prenom);
printf("\nle num est %d ",F.ad.num);
printf("\nle codepostal est %d",F.ad.codepostal);
printf("\nle rue est %s ",F.ad.rue);
printf("\nla ville est %s",F.ad.ville);
printf("\nla date(jour,mois,anné) est %d %d %d",F.da.jour,F.da.mois,F.da.anne);
}
void main()
{
H F;
lirefiche(&F);
Affich_fiche(F);
getch();
}
je veux faire une petite modification avec l'utilisation de typedef
mais ca marche pas
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
typedef struct
{int num;
char rue[50];
int codepostal;
char ville[50];
}ad;
typedef struct
{int jour;
int mois;
int anne;
}da;
typedef struct
{
char nom[50];
char prenom[50];
int telephonne;
struct adresse ad;
struct date da;
}H;
void lirefiche(H *F)
{
printf("donner le nom :");
scanf("%s",F->nom);
printf("donner le prenom :");
scanf("%s",F->prenom);
printf("donner num :");
scanf("%d",&F->ad.num);
printf("donner le codepostale :");
scanf("%d",&F->ad.codepostal);
printf("donner rue :");
scanf("%s",F->ad.rue);
printf("donner la ville :");
scanf("%s",F->ad.ville);
printf("donner la date :");
scanf("%d%d%d",&F->da.jour,&F->da.mois,&F->da.anne);
}
void Affich_fiche(H F)
{
printf("le nom est %s ",F.nom);
printf("\nle prenom est %s",F.prenom);
printf("\nle num est %d ",F.ad.num);
printf("\nle codepostal est %d",F.ad.codepostal);
printf("\nle rue est %s ",F.ad.rue);
printf("\nla ville est %s",F.ad.ville);
printf("\nla date(jour,mois,anné) est %d %d %d",F.da.jour,F.da.mois,F.da.anne);
}
void main()
{
H F;
lirefiche(&F);
Affich_fiche(F);
getch();
}
pouvez vous me corriger avec l'utilisation de typedef
merci d'avance
A voir également:
- Typedef "structure"
- Logiciel calcul structure bois gratuit - Télécharger - Architecture & Déco
- Structure d'un rapport de stage - Guide
- Structure url - Guide
- Trouvez l'erreur dans la structure du document et corrigez-la. - Forum Word
- Pdf structure 40 - Forum PDF