Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include<stdlib.h>
- struct da
- {
- int jour;
- int mois ;
- int annee;
- };
- typedef struct da date;
- void saisie (date *d);
- void affiche (date *d)
- {printf ("%d / %d / %d \n",d->jour ,d->mois ,d->annee);
- }
- main()
- {
- date *d1;
- d1=(date*) malloc (sizeof(date));
- saisie(d1);
- affiche(d1);
- date d2;
- saisie(&d2);
- affiche(&d2);
- }
- void saisie (date *d)
- {
- do{
- printf ("jour \n");
- scanf("%d",&(d->jour));}
- while (d->jour <1||d->jour>31);
- do{
- printf("mois \n");
- scanf ("%d",&(d->mois));}
- while (d->mois <1||d->mois>12);
- printf("annee \n");
- scanf ("%d",&(d->annee));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement