#include <stdlib.h> #include <stdio.h> typedef struct { char nom[100]; char prenom[100]; char adresse[100]; } Personne; int main(void) { const int size = 3; Personne informations[size]; int joueur = 0; while (joueur < size) { printf("Votre nom?\n"); scanf("%s", informations[joueur].nom); printf("Votre prenom?\n"); scanf("%s", informations[joueur].prenom); printf("Ou habitez vous?\n"); scanf("%s", informations[joueur].adresse); printf("\n\n"); ++joueur; } joueur = 0; while (joueur < size) { printf("joueur %i:\n nom: %s\n prenom: %s\n adresse: %s\n\n", joueur + 1, informations[joueur].nom, informations[joueur].prenom, informations[joueur].adresse); ++joueur; } return 0; }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question#include <stdlib.h> #include <stdio.h> #include "main.h" int main(int argc, char *argv[]) { Personnes information[3]; int joueur = 0; while (joueur < 3) { printf ("Votre nom?\n"); scanf ("%s", information[joueur].nom); printf ("Votre prenom?\n"); scanf ("%s", information[joueur].prenom); printf ("Ou habitez vous?\n"); scanf ("%s", information[joueur].adresse); printf ("\n\n"); joueur++; } printf ("joueur 1:\n nom- %s\n prenom- %s\n adresse- %s\n\n", information[0].nom, information[0].prenom, information[0].adresse); printf ("joueur 2:\n nom- %s\n prenom- %s\n adresse- %s\n\n", information[1].nom, information[1].prenom, information[1].adresse); printf ("joueur 3:\n nom- %s\n prenom- %s\n adresse- %s\n\n", information[2].nom, information[2].prenom, information[2].adresse); return 0; }
typedef struct Personnes Personnes; struct Personnes { char nom[100]; char prenom[100]; char adresse[100]; };