Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. #include "stdio.h"
  2. #include "string.h"
  3. #define rc() printf("\n");
  4. typedef struct personne personne;
  5.  
  6. struct personne{
  7. char nom[100];
  8. char prenom[100];
  9. char adresse[100];
  10. int age;
  11. int garcon; // Booléen : 1 = garçon, 0 = fille
  12. };
  13.  
  14. int main(int argc, char *argv[])
  15. {
  16. int i=0;
  17. for (i=0;i<10;i++){
  18. personne joueur[i];
  19. printf("Personne %d : Quel est votre nom ? ",i);
  20. scanf("%s",&joueur[i].nom);
  21. printf("Personne %d : Quel est votre prénom ? ",i);
  22. scanf("%s",&joueur[i].prenom);
  23. printf("Personne %d : Quel est votre adresse ? ",i);
  24. scanf("%s",&joueur[i].adresse);
  25. printf("Personne %d : Quel est votre age ? ",i);
  26. scanf("%d",&joueur[i].age);
  27. printf("Personne %d : Êtes-vous un garçon (1) où une fille ? ",i);
  28. scanf("%d",&joueur[i].garcon);
  29. printf("\n%d %s %s a %d ans, habite à %s et ",i,joueur[i].prenom,joueur[i].nom,joueur[i].age,joueur[i].adresse);
  30. if (joueur[i].garcon==1){
  31. printf("est un garçon.");
  32. } else printf("est une fille.");
  33. rc()
  34. }
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement