#include #include # define MAX_NOM 64 # define MAX_PRENOM 64 typedef struct { char nom[MAX_NOM+1]; char prenom[MAX_PRENOM+1]; int numero_compte; float solde; } CLIENT; void afficher_client(CLIENT c); void crediter_client(CLIENT* c, float montant); int main(void) { //déclaration d'un client avec initialisation CLIENT c1= {"LAMY","Alexandra",59605,5000}; //déclaration d'un client sans initialisation CLIENT c2,c3,c4; //enregistrement de clients sans initialisation float solde = 4500; c2=(CLIENT){.nom="LEGAULOIS",.prenom="Asterix",.numero_compte=59606,.solde=solde}; c3=(CLIENT){"DUPOND","Robert",c2.numero_compte+1,2000}; //changement de nom suite à un mariage strcpy(c1.nom,"DUJARDIN"); //copie d'un client c4=c2; //RAZ d'un client c2=(CLIENT){"","",0,0}; //retirer c3.solde=c3.solde-2500; //créditer float somme = 90000; crediter_client(&c4, somme); afficher_client(c1); afficher_client(c2); afficher_client(c3); afficher_client(c4); return 0; } void afficher_client(CLIENT c) { printf("\n\t%10s\t%10s\t%10d\t%10.2fEuros", c.nom, c.prenom, c.numero_compte, c.solde); } void crediter_client(CLIENT *c, float montant) { (*c).solde=(*c).solde+montant; }