IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C Discussion :

Besoin d'aide pour mon programme qui ne compile pas normalement


Sujet :

C

  1. #1
    Membre à l'essai
    Femme Profil pro
    Étudiant
    Inscrit en
    Avril 2013
    Messages
    21
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Sénégal

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2013
    Messages : 21
    Points : 17
    Points
    17
    Par défaut Besoin d'aide pour mon programme qui ne compile pas normalement
    Bonjour y a mon programme qui plante. je lui met un switch avec des case et un default mais si je fais un choix dans les case il exécute le default! si j'enleve le default il s'execute mais n'affiche rien!
    voici le code:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
     
    int main()
     {
          FILE* pt_fichier=NULL;
         int choix,i=0,j=0,k=0,nbp=0,recup_val;
         char debu_ID[6]="CL";
         char choix1,choi;
              char  nouv_nom[25],nouv_num[10],nouv_mail[25],nom[25],num[10],mail[25],c_nbp[4];
                  Contact* directory[MAX_rep];
           	    pt_fichier=fopen("repertoire_telephonique.rpt","a+");
       if(pt_fichier==NULL)
     printf("Sorry can't open test_rep file\n");
     else{
    		do{
     
    main_menu(choix);
    switch(choix)
        {
    		case 1:
     
           printf("    +------------------------------+\n");
    	   printf("    |      AJOUT D'UN CONTACT      |\n");
    	   printf("    +------------------------------+\n");
    	   printf("enter the full name of the contact to add\n");
    	   gets(nouv_nom);
    	   recup_val=rechercher_nom(directory,nouv_nom,nbp);
    	if(recup_val==-1){
    	   nbp=ajout_contact(pt_fichier,directory,nouv_nom,mail,num,nbp,i);
    	   generateur_de_id(directory,debu_ID,c_nbp,nbp,i);
    	   	   for(k=0;k<6;k++){
                if(strncmp(directory[i]->tel,debutTelValide[k],2)==0){
                    if(k==1 || k==2){
                     directory[i]->type= strdup("mobile orange");
    	            }
    	            if(k==3){
                    directory[i]->type= strdup("mobile tigo");
    	            }
    	            if(k==4){
                    directory[i]->type= strdup("mobile expresso");
    	            }
    	            if(k==5){
                     directory[i]->type= strdup("fixe orange");
    	            }
    	            if(k==6){
                    directory[i]->type= strdup("fixe expresso");
    	            }
                }
    	   }
    	}
     
    	     	 	else
    				printf("\n	NOM DEJA ENREGISTRE");
    					fclose(pt_fichier);
    			break;
    			case 2:
    			pt_fichier=fopen("repertoire_telephonique.rpt","r");
     
    			rewind(pt_fichier);
             do{
           printf("    +-------------------------------+\n");
    	   printf("    |      RECHERCHER UN CONTACT    |\n");
    	   printf("    +------------------------------ +\n");
           printf("    +-------------------------------+\n");
           printf("    | n par nom                     |\n");
           printf("    | e par email                   |\n");
           printf("    | t par numero de telephone     |\n");
           printf("    +-------------------------------+\n");
                                 printf("choisissez une option\n");
                                       scanf("%d",&choix1);
                                      system("cls");
     }while(choix1 !='n' || choix1!='e'|| choix1!='t');
      switch(choix1){
    		case 'n':
                printf("	Entrez le nom a chercher : ");
    			gets(nom);
    			recup_val = rechercher_nom(directory,nouv_nom,nbp);
    			if (recup_val==-1)
    				printf("\n	NOM INCONNU");
    			else
    				rechercher_contact(directory,recup_val);
    			break;
    			case 'e':
                     printf("	Entrez le mail a chercher : ");
    			gets(mail);
    			recup_val = rechercher_mail(directory,mail,nbp);
    			if (recup_val==-1)
    				printf("\n	MAIL INCONNU");
    			else
    				rechercher_contact(directory,recup_val);
    				break;
    		   case 't':
                     printf("	Entrez le numero de tel a chercher : ");
    			gets(num);
    			recup_val = rechercher_num(directory,num,nbp);
    			if (recup_val==-1)
    				printf("\n NUMERO DE TELEPHONE INCONNU\n");
    			else
    				rechercher_contact(directory,recup_val);
    				break;
    				default:
    					printf("choix impossible");
      }
      break;
    			fclose(pt_fichier);
    		case 3:
                pt_fichier=fopen("repertoire_telephonique.rpt","r+");
     
    			rewind(pt_fichier);
           printf("    +------------------------------+\n");
    	   printf("    |      SUPPRIMER UN CONTACT    |\n");
    	   printf("    +------------------------------+\n");
     
    			printf("	Entrez le nom a supprimer : ");
    			gets(nouv_nom);
    			recup_val=rechercher_nom(directory,nouv_nom,nbp);
    				if(recup_val==-1)
    				printf("\n NOM INCONNU");
    			else{
    				nbp = supprimer(directory,nbp,recup_val);
    				for(i=0;i<nbp;i++){
    				generateur_de_id(directory,debu_ID,c_nbp,nbp,i);
    				}
    			}
    				fclose(pt_fichier);
    							break;
    		case 4:
    		    pt_fichier=fopen("repertoire_telephonique.rpt","r");
    		    rewind(pt_fichier);
            printf("+----+++----+++----+++----+++----+++----+++----+++----+++----+++----+++----+++----+\n");
    		printf("|                                LISTE DES CONTACTS                                |\n");
    		printf("+----+++----+++----+++----+++----+++----+++----+++----+++----+++----+++----+++----+\n");
    					if(nbp > 0)
    				lister_contact(directory,nbp);
    			else
    				printf("\n	REPERTOIRE VIDE\n");
    				fclose(pt_fichier);
    			break;
    		case 5 :
    		pt_fichier=fopen("repertoire_telephonique.rpt","a+");
     
    		rewind(pt_fichier);
    		do{
    	   printf("    +------------------------------ +\n");
    	   printf("    |      MODIFIER  UN CONTACT     |\n");
    	   printf("    +------------------------------ +\n");
           printf("    +-------------------------------+\n");
    	   printf("    | n par nom                     |\n");
    	   printf("    | e par email                   |\n");
    	   printf("    | t par numero de telephone     |\n");
    	   printf("    +-------------------------------+\n");
                                 printf("choisissez une option\n");
                                       scanf("%d",&choi);
                                      system("cls");
            }while(choi !='n' || choi!='e'|| choi!='t');
     
                                      switch(choi)
                                      {
                                        case 'n':
                                            modifier_nom(pt_fichier,directory,nbp,nom,nouv_nom,recup_val,i);
    			                         break;
    			                        case 'e':
                                        modifier_mail(pt_fichier,directory,nbp,mail,nouv_mail,recup_val,i);
    						         	break;
    		                            case 't':
                                        modifier_nom(pt_fichier,directory,nbp,num,nouv_num,recup_val,i);
    			                       	break;
    			                       	default:
                                            printf("choix impossible");
                                     }
      fclose(pt_fichier);
      break;
    	   		case 6 :
    	   		pt_fichier=fopen("repertoire_telephonique.rpt","r");
     
    		rewind(pt_fichier);
     
    			quitter(directory,nbp);
    			break;
    		default:
    			printf("\n	Cette option n'existe pas!");
    		}
     
    		PAUSE(); // On appelle une fonction Pause() qui permet de revenir au menu en appuyant sur une touche quelconque du clavier.
     
    	} while (1);
    	} // J'utilise ici une boucle infini, ça me permet d'afficher le menu une fois qu'une tâche a été réalisé.
               fclose(pt_fichier);
    getch();
    return 0;
     
     }

  2. #2
    Inactif  


    Homme Profil pro
    Doctorant sécurité informatique — Diplômé master Droit/Économie/Gestion
    Inscrit en
    Décembre 2011
    Messages
    9 012
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Loire (Rhône Alpes)

    Informations professionnelles :
    Activité : Doctorant sécurité informatique — Diplômé master Droit/Économie/Gestion
    Secteur : Enseignement

    Informations forums :
    Inscription : Décembre 2011
    Messages : 9 012
    Points : 23 145
    Points
    23 145
    Par défaut
    Bonjour,



    Sinon, peux-tu au moins nous dire quelles sont les problèmes que rencontre ton application pour que nous puissions t'aider ?

  3. #3
    Membre à l'essai
    Femme Profil pro
    Étudiant
    Inscrit en
    Avril 2013
    Messages
    21
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Sénégal

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2013
    Messages : 21
    Points : 17
    Points
    17
    Par défaut
    desole! j'ai envoyé sans avoir verifié ! mais c'est modifié maintenant ! tu peux voir en haut

  4. #4
    Inactif  


    Homme Profil pro
    Doctorant sécurité informatique — Diplômé master Droit/Économie/Gestion
    Inscrit en
    Décembre 2011
    Messages
    9 012
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Loire (Rhône Alpes)

    Informations professionnelles :
    Activité : Doctorant sécurité informatique — Diplômé master Droit/Économie/Gestion
    Secteur : Enseignement

    Informations forums :
    Inscription : Décembre 2011
    Messages : 9 012
    Points : 23 145
    Points
    23 145
    Par défaut
    Peux-tu aussi soigner l'orthographe ainsi que l'indentation de ton code ?

    Sinon, pour rendre ton code plus compréhensible, n'hésite pas à créer des fonctions comme afficherMenu() :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    void afficherMenu(void)
    {
               puts("Mon joli menu");
               puts("Faites un choix");
    }
     
    int lireChoixUtilisateur(void)
    {
              // TODO
    }
    En l'état, ton code est assez difficile à lire.

  5. #5
    Membre expert
    Avatar de Metalman
    Homme Profil pro
    Enseignant-Chercheur
    Inscrit en
    Juin 2005
    Messages
    1 049
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Enseignant-Chercheur
    Secteur : Enseignement

    Informations forums :
    Inscription : Juin 2005
    Messages : 1 049
    Points : 3 532
    Points
    3 532
    Par défaut
    Je vais grandement plussoyer toutes les remarques de Neckara...
    Et en effet, je crois que nul part "choix" n'est initialisé !
    Du coup, en effet le switch/case va partir dans default (ou "par chance" dans un des cas).

    main_menu n'est pas censé renvoyer un int ?
    ça ne devrait pas plutôt être :
    ou
    --
    Metalman !

    Attendez 5 mins après mes posts... les EDIT vont vite avec moi...
    Les flags de la vie : gcc -W -Wall -Werror -ansi -pedantic mes_sources.c
    gcc -Wall -Wextra -Werror -std=c99 -pedantic mes_sources.c
    (ANSI retire quelques fonctions comme strdup...)
    L'outil de la vie : valgrind --show-reachable=yes --leak-check=full ./mon_programme
    Et s'assurer que la logique est bonne "aussi" !

    Ma page Developpez.net

  6. #6
    Membre à l'essai
    Femme Profil pro
    Étudiant
    Inscrit en
    Avril 2013
    Messages
    21
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Sénégal

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2013
    Messages : 21
    Points : 17
    Points
    17
    Par défaut
    Si il y a une fonction qui affiche le menu, c'est main_menu ! Il affiche le menu principal du répertoire

    Non main_menu c'est un void. Il affiche juste le menu et garde le choix; j'ai initialisé le choix mais toujours pareil !

  7. #7
    Inactif  


    Homme Profil pro
    Doctorant sécurité informatique — Diplômé master Droit/Économie/Gestion
    Inscrit en
    Décembre 2011
    Messages
    9 012
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : France, Loire (Rhône Alpes)

    Informations professionnelles :
    Activité : Doctorant sécurité informatique — Diplômé master Droit/Économie/Gestion
    Secteur : Enseignement

    Informations forums :
    Inscription : Décembre 2011
    Messages : 9 012
    Points : 23 145
    Points
    23 145
    Par défaut
    Bonjour,

    Si vous n'indentez pas votre code et ne soignez pas votre orthographe, je doute qu'on continue à vous aider.

    Votre code est illisible, si vous qu'on le lise indentez-le.

  8. #8
    Membre expert
    Avatar de Metalman
    Homme Profil pro
    Enseignant-Chercheur
    Inscrit en
    Juin 2005
    Messages
    1 049
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Enseignant-Chercheur
    Secteur : Enseignement

    Informations forums :
    Inscription : Juin 2005
    Messages : 1 049
    Points : 3 532
    Points
    3 532
    Par défaut
    Dans ton code posté plus haut il n'est initialisé nul part "choix".

    Ce sont les autres variables qui sont initialisées à 0.

    Essaye explicitement juste avant le switch de le mettre à 0 !
    (et passe ton code là dedans : indentcode.net/)
    --
    Metalman !

    Attendez 5 mins après mes posts... les EDIT vont vite avec moi...
    Les flags de la vie : gcc -W -Wall -Werror -ansi -pedantic mes_sources.c
    gcc -Wall -Wextra -Werror -std=c99 -pedantic mes_sources.c
    (ANSI retire quelques fonctions comme strdup...)
    L'outil de la vie : valgrind --show-reachable=yes --leak-check=full ./mon_programme
    Et s'assurer que la logique est bonne "aussi" !

    Ma page Developpez.net

  9. #9
    Modérateur
    Avatar de gangsoleil
    Homme Profil pro
    Manager / Cyber Sécurité
    Inscrit en
    Mai 2004
    Messages
    10 150
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Manager / Cyber Sécurité

    Informations forums :
    Inscription : Mai 2004
    Messages : 10 150
    Points : 28 119
    Points
    28 119
    Par défaut
    Bonjour,

    Voici le code indente :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    int main()
    {
      FILE* pt_fichier=NULL;
      int choix,i=0,j=0,k=0,nbp=0,recup_val;
      char debu_ID[6]="CL";
      char choix1,choi;
      char  nouv_nom[25],nouv_num[10],nouv_mail[25],nom[25],num[10],mail[25],c_nbp[4];
      Contact* directory[MAX_rep];
      pt_fichier=fopen("repertoire_telephonique.rpt","a+");
      if(pt_fichier==NULL)
        printf("Sorry can't open test_rep file\n");
      else
      {
        do
        {
          main_menu(choix);
          switch(choix)
          {
            case 1:
     
              printf("    +------------------------------+\n");
              printf("    |      AJOUT D'UN CONTACT      |\n");
              printf("    +------------------------------+\n");
              printf("enter the full name of the contact to add\n");
              gets(nouv_nom);
              recup_val=rechercher_nom(directory,nouv_nom,nbp);
              if(recup_val==-1)
              {
                nbp=ajout_contact(pt_fichier,directory,nouv_nom,mail,num,nbp,i);
                generateur_de_id(directory,debu_ID,c_nbp,nbp,i);
                for(k=0;k<6;k++)
                {
                  if(strncmp(directory[i]->tel,debutTelValide[k],2)==0)
                  {
                    if(k==1 || k==2){
                      directory[i]->type= strdup("mobile orange");
                    }
                    if(k==3){
                      directory[i]->type= strdup("mobile tigo");
                    }
                    if(k==4){
                      directory[i]->type= strdup("mobile expresso");
                    }
                    if(k==5){
                      directory[i]->type= strdup("fixe orange");
                    }
                    if(k==6){
                      directory[i]->type= strdup("fixe expresso");
                    }
                  }
                }
              }
              else
                printf("\n  NOM DEJA ENREGISTRE");
     
              fclose(pt_fichier);
              break;
     
            case 2:
              pt_fichier=fopen("repertoire_telephonique.rpt","r");
     
              rewind(pt_fichier);
              do{
                printf("    +-------------------------------+\n");
                printf("    |      RECHERCHER UN CONTACT    |\n");
                printf("    +------------------------------ +\n");
                printf("    +-------------------------------+\n");
                printf("    | n par nom                     |\n");
                printf("    | e par email                   |\n");
                printf("    | t par numero de telephone     |\n");
                printf("    +-------------------------------+\n");
                printf("choisissez une option\n");
                scanf("%d",&choix1);
                system("cls");
              }while(choix1 !='n' || choix1!='e'|| choix1!='t');
     
              switch(choix1)
              {
                case 'n':
                  printf("  Entrez le nom a chercher : ");
                  gets(nom);
                  recup_val = rechercher_nom(directory,nouv_nom,nbp);
                  if (recup_val==-1)
                    printf("\n  NOM INCONNU");
                  else
                    rechercher_contact(directory,recup_val);
                  break;
                case 'e':
                  printf(" Entrez le mail a chercher : ");
                  gets(mail);
                  recup_val = rechercher_mail(directory,mail,nbp);
                  if (recup_val==-1)
                    printf("\n  MAIL INCONNU");
                  else
                    rechercher_contact(directory,recup_val);
                  break;
                case 't':
                  printf("  Entrez le numero de tel a chercher : ");
                  gets(num);
                  recup_val = rechercher_num(directory,num,nbp);
                  if (recup_val==-1)
                    printf("\n NUMERO DE TELEPHONE INCONNU\n");
                  else
                    rechercher_contact(directory,recup_val);
     
                  break;
     
                default:
                  printf("choix impossible");
              }
              break;
              fclose(pt_fichier);
     
            case 3:
              pt_fichier=fopen("repertoire_telephonique.rpt","r+");
     
              rewind(pt_fichier);
              printf("    +------------------------------+\n");
              printf("    |      SUPPRIMER UN CONTACT    |\n");
              printf("    +------------------------------+\n");
     
              printf("  Entrez le nom a supprimer : ");
              gets(nouv_nom);
              recup_val=rechercher_nom(directory,nouv_nom,nbp);
     
              if(recup_val==-1)
                printf("\n NOM INCONNU");
              else
              {
                nbp = supprimer(directory,nbp,recup_val);
                for(i=0;i<nbp;i++)
                {
                  generateur_de_id(directory,debu_ID,c_nbp,nbp,i);
                }
              }
              fclose(pt_fichier);
              break;
     
            case 4:
              pt_fichier=fopen("repertoire_telephonique.rpt","r");
              rewind(pt_fichier);
              printf("+----+++----+++----+++----+++----+++----+++----+++----+++----+++----+++----+++----+\n");
              printf("|                                LISTE DES CONTACTS                                |\n");
              printf("+----+++----+++----+++----+++----+++----+++----+++----+++----+++----+++----+++----+\n");
              if(nbp > 0)
                lister_contact(directory,nbp);
              else
                printf("\n  REPERTOIRE VIDE\n");
              fclose(pt_fichier);
              break;
            case 5 :
              pt_fichier=fopen("repertoire_telephonique.rpt","a+");
     
              rewind(pt_fichier);
              do{
                printf("    +------------------------------ +\n");
                printf("    |      MODIFIER  UN CONTACT     |\n");
                printf("    +------------------------------ +\n");
                printf("    +-------------------------------+\n");
                printf("    | n par nom                     |\n");
                printf("    | e par email                   |\n");
                printf("    | t par numero de telephone     |\n");
                printf("    +-------------------------------+\n");
                printf("choisissez une option\n");
                scanf("%d",&choi);
                system("cls");
              }while(choi !='n' || choi!='e'|| choi!='t');
     
              switch(choi)
              {
                case 'n':
                  modifier_nom(pt_fichier,directory,nbp,nom,nouv_nom,recup_val,i);
                  break;
                case 'e':
                  modifier_mail(pt_fichier,directory,nbp,mail,nouv_mail,recup_val,i);
                  break;
                case 't':
                  modifier_nom(pt_fichier,directory,nbp,num,nouv_num,recup_val,i);
                  break;
                default:
                  printf("choix impossible");
              }
              fclose(pt_fichier);
              break;
            case 6 :
              pt_fichier=fopen("repertoire_telephonique.rpt","r");
     
              rewind(pt_fichier);
     
              quitter(directory,nbp);
              break;
            default:
              printf("\n  Cette option n'existe pas!");
          }
     
          PAUSE(); // On appelle une fonction Pause() qui permet de revenir au menu en appuyant sur une touche quelconque du clavier.
     
        } while (1);
      } // J'utilise ici une boucle infini, ga me permet d'afficher le menu une fois qu'une tbche a iti rialisi.
      fclose(pt_fichier);
      getch();
      return 0;
    }
    Voici les erreus de compilation qu'il genere, sans forcer :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    > gcc -Wall -O2 -Wextra -W test_dev.c
    test_dev.c: In function 'main':
    test_dev.c:10: error: 'Contact' undeclared (first use in this function)
    test_dev.c:10: error: (Each undeclared identifier is reported only once
    test_dev.c:10: error: for each function it appears in.)
    test_dev.c:10: error: 'directory' undeclared (first use in this function)
    test_dev.c:10: error: 'MAX_rep' undeclared (first use in this function)
    test_dev.c:18: warning: implicit declaration of function 'main_menu'
    test_dev.c:28: warning: implicit declaration of function 'rechercher_nom'
    test_dev.c:31: warning: implicit declaration of function 'ajout_contact'
    test_dev.c:32: warning: implicit declaration of function 'generateur_de_id'
    test_dev.c:35: warning: implicit declaration of function 'strncmp'
    test_dev.c:35: error: 'debutTelValide' undeclared (first use in this function)
    test_dev.c:38: warning: implicit declaration of function 'strdup'
    test_dev.c:38: warning: incompatible implicit declaration of built-in function 'strdup'
    test_dev.c:41: warning: incompatible implicit declaration of built-in function 'strdup'
    test_dev.c:44: warning: incompatible implicit declaration of built-in function 'strdup'
    test_dev.c:47: warning: incompatible implicit declaration of built-in function 'strdup'
    test_dev.c:50: warning: incompatible implicit declaration of built-in function 'strdup'
    test_dev.c:75: warning: format '%d' expects type 'int *', but argument 2 has type 'char *'
    test_dev.c:76: warning: implicit declaration of function 'system'
    test_dev.c:88: warning: implicit declaration of function 'rechercher_contact'
    test_dev.c:93: warning: implicit declaration of function 'rechercher_mail'
    test_dev.c:102: warning: implicit declaration of function 'rechercher_num'
    test_dev.c:132: warning: implicit declaration of function 'supprimer'
    test_dev.c:148: warning: implicit declaration of function 'lister_contact'
    test_dev.c:167: warning: format '%d' expects type 'int *', but argument 2 has type 'char *'
    test_dev.c:174: warning: implicit declaration of function 'modifier_nom'
    test_dev.c:177: warning: implicit declaration of function 'modifier_mail'
    test_dev.c:192: warning: implicit declaration of function 'quitter'
    test_dev.c:198: warning: implicit declaration of function 'PAUSE'
    test_dev.c:203: warning: implicit declaration of function 'getch'
    test_dev.c:6: warning: unused variable 'j'
    Outre ca, ton code a de serieux soucis...

    Tu ouvres ton fichier avant le switch, mais aussi dedans... Et tu le fermes dans certains cas, mais pas dans tous...
    Tu utilises des switchs, imbriques, mais dans tous les cas :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
                    if(k==1 || k==2){
                      directory[i]->type= strdup("mobile orange");
                    }
                    if(k==3){
                      directory[i]->type= strdup("mobile tigo");
                    }
                    if(k==4){
                      directory[i]->type= strdup("mobile expresso");
                    }
                    if(k==5){
                      directory[i]->type= strdup("fixe orange");
                    }
                    if(k==6){
                      directory[i]->type= strdup("fixe expresso");
                    }

    Je pense que tu devrais t'eloigner de ton code, et reprendre l'algorithme "a froid", c'est a dire chercher ce que tu veux faire, dans quel cas, comment le faire, et l'ecrire sur un papier/document/autre.

    Une fois que tu auras fait ca, ca devrait t'aider pour ton code.

    [Edit]
    Choisis des noms de variable qui soient significatifs, pas :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    int choix;
    char choix1, choi;
    "La route est longue, mais le chemin est libre" -- https://framasoft.org/
    Les règles du forum

Discussions similaires

  1. besoin d'aide pour mon programme
    Par pouyoudu17 dans le forum Débuter avec Java
    Réponses: 11
    Dernier message: 28/05/2007, 22h18
  2. [débutant] besoin d'aide pour un programme
    Par acdchornet dans le forum C++
    Réponses: 12
    Dernier message: 26/10/2006, 22h32
  3. besoin d'aide pour mon future site
    Par vulquin dans le forum Général Conception Web
    Réponses: 3
    Dernier message: 11/06/2006, 20h33
  4. [Free Pascal] Besoin d'aide pour un programme
    Par ricomix dans le forum Free Pascal
    Réponses: 3
    Dernier message: 04/06/2006, 17h01
  5. Besoin d'aide pour mon rpg en javascript
    Par CyberTwister dans le forum Général JavaScript
    Réponses: 9
    Dernier message: 07/04/2006, 13h26

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo