Page 985 - IT2
P. 985

Finpour

                   Fin

               d)  Regrouper les trois sous algorithmes précédents dans un algorithme principal.







            Partie pratique :

            DOSSIER I– LANGAGE DE  PROGRAMMATION STRUCTUREE

            #include<stdio.h>
            #include<stdlib.h>
            #include<string.h>
            //1- création de la structure abonne et de la structure date

            typedef struct date{
                                                  int jour ;
                                                 int mois;
                int annee;
            }date;

            typedef struct abonne{
                                               char nom[50];
                                                char cin[8];
                                            char telephone[10];
                                             char typeAbon[30];
                                              date dateAbon;
            }abonne;


            //3- procédure ajout d'un nouvel abonne
            void ajoutAbonne()
            {
                 // ouverture du fichier en mode ajout
             FILE*  fichier = fopen("abonnes.dat", "a");
                // Récupération d'un abonné au prés de l'utilisateur
                 abonne ab;

              printf("donner le nom de l'abonne");
              scanf("%s",&ab.nom);
              printf("donner le CIN de l'abonne");
              scanf("%s",&ab.cin);
                  Filière                    Epreuve                       Session              4/12
                  TDM                  Synthèse V1(Correction)            Juillet 2014
                                          www.itlearning-settat.com

                                   Email: admission@itlearning-settat.com
                                                   Tél.:0661077812
   980   981   982   983   984   985   986   987   988   989   990