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 :

Affichage du contenu d'une liste chainée


Sujet :

C

  1. #1
    Débutant Avatar de étoile de mer
    Profil pro
    Étudiant
    Inscrit en
    Avril 2007
    Messages
    978
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2007
    Messages : 978
    Points : 117
    Points
    117
    Par défaut Affichage du contenu d'une liste chainée
    Bonjour,
    J'ai un probleme, ( je developpe en C)
    j'ai une fonction qui parcourt toute la liste chainee qui contient des mots , jai reussi à faire l'affichage de la liste mais le probleme c'est qu'il n ya pas un espace entre les differents mot
    exple il affiche "lebateau " au lieu du "le bateau".
    j'attends vos reponse.
    merci
    Le jour est le père du labeur et la nuit est la mère des pensées.

  2. #2
    Expert éminent sénior
    Avatar de diogene
    Homme Profil pro
    Enseignant Chercheur
    Inscrit en
    Juin 2005
    Messages
    5 761
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Enseignant Chercheur
    Secteur : Enseignement

    Informations forums :
    Inscription : Juin 2005
    Messages : 5 761
    Points : 13 926
    Points
    13 926
    Par défaut
    Voyons, sans une ligne de code, comment veux-tu qu'on puisse deviner ?
    Si le code est donné dans un autre post, met un lien ou au moins le titre de cette discussion.
    Publication : Concepts en C

    Mon avatar : Glenn Gould

    --------------------------------------------------------------------------
    Une réponse vous a été utile ? Remerciez son auteur en cliquant le pouce vert !

  3. #3
    Membre confirmé
    Inscrit en
    Juillet 2005
    Messages
    512
    Détails du profil
    Informations forums :
    Inscription : Juillet 2005
    Messages : 512
    Points : 641
    Points
    641
    Par défaut
    le probleme c'est qu'il n ya pas un espace entre les differents mot
    Et bien tu l'ajoute lors de l'affichage.

    Je suppose qu'un maillon contient un mot !

  4. #4
    Expert éminent sénior
    Avatar de Emmanuel Delahaye
    Profil pro
    Retraité
    Inscrit en
    Décembre 2003
    Messages
    14 512
    Détails du profil
    Informations personnelles :
    Âge : 67
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Décembre 2003
    Messages : 14 512
    Points : 20 985
    Points
    20 985
    Par défaut
    Citation Envoyé par cyrine Voir le message
    j'ai une fonction qui parcourt toute la liste chainee qui contient des mots , jai reussi à faire l'affichage de la liste mais le probleme c'est qu'il n ya pas un espace entre les differents mot
    exple il affiche "lebateau " au lieu du "le bateau".
    j
    C'est peut être à toi d'ajouter l'espace, tu ne crois pas ?

    Arf ! Grillaid...

    Montre ton code.
    Pas de Wi-Fi à la maison : CPL

  5. #5
    Débutant Avatar de étoile de mer
    Profil pro
    Étudiant
    Inscrit en
    Avril 2007
    Messages
    978
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2007
    Messages : 978
    Points : 117
    Points
    117
    Par défaut re
    Citation Envoyé par Emmanuel Delahaye Voir le message
    C'est peut être à toi d'ajouter l'espace, tu ne crois pas ?

    Arf ! Grillaid...

    Montre ton 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
     
     
    int main()
    {
      FILE *F;
      char mot[100];
      int i;
      unsigned int cle,pt;
      int nl, pos;
      nl=pos=1;
      char c;
      int seuil;
      Liste **L;
     
      Liste **TableHash;
      TableHash = (Liste **) malloc (TAILLEHASH * sizeof(Liste *));
      for(i=0;i<TAILLEHASH;++i)
        TableHash[i] = NULL;
     
      pt=hash_cle(".");
      //printf("%d",pt);
     
      printf("debut du programme \n----------------------------------\n");  
      F=fopen("C:\\Documents and Settings\\siril\\Bureau\\projet\\text.txt","r");
      while(fscanf(F,"%s",mot)==1){
           cle = hash_cle(mot);
          if ((cle!=pt ) && (! ChercherMotDansTableHash(TableHash,mot)))
                TableHash[cle] = InsertionEnTete(TableHash[cle],mot);     
      }
      fclose(F );
      F=fopen("C:\\Documents and Settings\\siril\\Bureau\\projet\\text.txt","r");
      PosLigne(F,TableHash);
     
      //filtrage 
      printf("\nla liste filtre :\n----------------------------------\n");
      FiltreListe(TableHash,2);
      AfficherTableHash(TableHash);
     
      //géneration des 2seq
      Liste *seq=NULL;
      Generer2seq(TableHash, 2, &seq);
      printf("\nla liste des 2seq :\n----------------------------------\n");
      AfficherListe(seq);
     
      scanf("%c",c);
     
      return 0;
    }
     
     
    void AfficherListe(Liste *L){
      Liste *p;
      for(p=L;p!=NULL;p=p->suivant){
        AfficheMot(p->mot);
        AfficherCoordonnees(p->c);
      }
    }
     
     
    void AfficheMot(char *mot){
      printf("%s ",mot);
    }
    voilà
    Le jour est le père du labeur et la nuit est la mère des pensées.

  6. #6
    Débutant Avatar de étoile de mer
    Profil pro
    Étudiant
    Inscrit en
    Avril 2007
    Messages
    978
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2007
    Messages : 978
    Points : 117
    Points
    117
    Par défaut re
    Citation Envoyé par Lucien63 Voir le message
    Et bien tu l'ajoute lors de l'affichage.

    Je suppose qu'un maillon contient un mot !
    cbien ça chaque maillon contient un mot
    Le jour est le père du labeur et la nuit est la mère des pensées.

  7. #7
    Expert éminent sénior
    Avatar de Emmanuel Delahaye
    Profil pro
    Retraité
    Inscrit en
    Décembre 2003
    Messages
    14 512
    Détails du profil
    Informations personnelles :
    Âge : 67
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Décembre 2003
    Messages : 14 512
    Points : 20 985
    Points
    20 985
    Par défaut
    Citation Envoyé par cyrine Voir le message
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    void AfficheMot(char *mot){
      printf("%s ",mot);
    }
    Cette fonction devrait afficher les mots séparés par un ' '. Elle est bien appelée ?

    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
     
     
    -------------- Build: Debug in hello ---------------
     
    Compiling: main.c
    C:\dev\hello\main.c:3: warning: function declaration isn't a prototype
    C:\dev\hello\main.c: In function `main':
    C:\dev\hello\main.c:4: error: `FILE' undeclared (first use in this function)
    C:\dev\hello\main.c:4: error: (Each undeclared identifier is reported only once
    C:\dev\hello\main.c:4: error: for each function it appears in.)
    C:\dev\hello\main.c:4: error: `F' undeclared (first use in this function)
    C:\dev\hello\main.c:12: error: `Liste' undeclared (first use in this function)
    C:\dev\hello\main.c:12: error: `L' undeclared (first use in this function)
    C:\dev\hello\main.c:14: error: `TableHash' undeclared (first use in this function)
    C:\dev\hello\main.c:15: error: syntax error before ')' token
    C:\dev\hello\main.c:16: error: `TAILLEHASH' undeclared (first use in this function)
    C:\dev\hello\main.c:17: error: `NULL' undeclared (first use in this function)
    C:\dev\hello\main.c:19: warning: implicit declaration of function `hash_cle'
    C:\dev\hello\main.c:20: error: syntax error before '/' token
    C:\dev\hello\main.c:22: warning: implicit declaration of function `printf'
    C:\dev\hello\main.c:23: warning: implicit declaration of function `fopen'
    C:\dev\hello\main.c:24: warning: implicit declaration of function `fscanf'
    C:\dev\hello\main.c:26: warning: implicit declaration of function `ChercherMotDansTableHash'
    C:\dev\hello\main.c:27: warning: implicit declaration of function `InsertionEnTete'
    C:\dev\hello\main.c:29: warning: implicit declaration of function `fclose'
    C:\dev\hello\main.c:31: warning: implicit declaration of function `PosLigne'
    C:\dev\hello\main.c:33: error: syntax error before '/' token
    C:\dev\hello\main.c:35: warning: implicit declaration of function `FiltreListe'
    C:\dev\hello\main.c:36: warning: implicit declaration of function `AfficherTableHash'
    C:\dev\hello\main.c:38: error: syntax error before '/' token
    C:\dev\hello\main.c:38: error: stray '\233' in program
    C:\dev\hello\main.c:38:20: invalid suffix "seq" on integer constant
    C:\dev\hello\main.c:40: warning: implicit declaration of function `Generer2seq'
    C:\dev\hello\main.c:40: error: `seq' undeclared (first use in this function)
    C:\dev\hello\main.c:42: warning: implicit declaration of function `AfficherListe'
    C:\dev\hello\main.c:44: warning: implicit declaration of function `scanf'
    C:\dev\hello\main.c:44: warning: format argument is not a pointer (arg 2)
    C:\dev\hello\main.c:11: warning: unused variable `seuil'
    C:\dev\hello\main.c: At top level:
    C:\dev\hello\main.c:50: error: syntax error before '*' token
    C:\dev\hello\main.c:50: warning: function declaration isn't a prototype
    C:\dev\hello\main.c:50: error: conflicting types for 'AfficherListe'
    C:\dev\hello\main.c:42: error: previous implicit declaration of 'AfficherListe' was here
    C:\dev\hello\main.c: In function `AfficherListe':
    C:\dev\hello\main.c:51: error: `Liste' undeclared (first use in this function)
    C:\dev\hello\main.c:51: error: `p' undeclared (first use in this function)
    C:\dev\hello\main.c:52: error: `L' undeclared (first use in this function)
    C:\dev\hello\main.c:52: error: `NULL' undeclared (first use in this function)
    C:\dev\hello\main.c:53: warning: implicit declaration of function `AfficheMot'
    C:\dev\hello\main.c:54: warning: implicit declaration of function `AfficherCoordonnees'
    C:\dev\hello\main.c: At top level:
    C:\dev\hello\main.c:59: error: conflicting types for 'AfficheMot'
    C:\dev\hello\main.c:53: error: previous implicit declaration of 'AfficheMot' was here
    Process terminated with status 1 (0 minutes, 0 seconds)
    25 errors, 19 warnings
    On peut avoir la version compilable ?
    Pas de Wi-Fi à la maison : CPL

  8. #8
    Membre confirmé Avatar de KindPlayer
    Profil pro
    Inscrit en
    Février 2007
    Messages
    471
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2007
    Messages : 471
    Points : 477
    Points
    477
    Par défaut suggestion
    dans ta fonction AfficherListe tu peux rajouter printf(" "); apres l'appel à AfficherMot
    La science est ce que nous comprenons suffisamment bien pour l'expliquer à un ordinateur. L'art, c'est tout ce que nous faisons d'autre.
    Donald E. Knuth

  9. #9
    Expert éminent sénior
    Avatar de Emmanuel Delahaye
    Profil pro
    Retraité
    Inscrit en
    Décembre 2003
    Messages
    14 512
    Détails du profil
    Informations personnelles :
    Âge : 67
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Décembre 2003
    Messages : 14 512
    Points : 20 985
    Points
    20 985
    Par défaut
    Citation Envoyé par KindPlayer Voir le message
    dans ta fonction AfficherListe tu peux rajouter printf(" "); apres l'appel à AfficherMot
    Pourquoi ? Il y a déjà un espace dans le formatage de printf(). Tu ne le vois pas ?
    Pas de Wi-Fi à la maison : CPL

  10. #10
    Membre confirmé
    Inscrit en
    Juillet 2005
    Messages
    512
    Détails du profil
    Informations forums :
    Inscription : Juillet 2005
    Messages : 512
    Points : 641
    Points
    641
    Par défaut
    cyrine a terminé son dernier post par :
    voilà
    C'est peut-être que ça fonctionne maintenant ?

  11. #11
    Débutant Avatar de étoile de mer
    Profil pro
    Étudiant
    Inscrit en
    Avril 2007
    Messages
    978
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2007
    Messages : 978
    Points : 117
    Points
    117
    Par défaut
    Citation Envoyé par Lucien63 Voir le message
    cyrine a terminé son dernier post par :

    C'est peut-être que ça fonctionne maintenant ?
    non ca fonctionne pas, j'attends toujours vos reponses
    Le jour est le père du labeur et la nuit est la mère des pensées.

  12. #12
    Membre confirmé
    Inscrit en
    Juillet 2005
    Messages
    512
    Détails du profil
    Informations forums :
    Inscription : Juillet 2005
    Messages : 512
    Points : 641
    Points
    641
    Par défaut
    non ca fonctionne pas, j'attends toujours vos reponses
    Tu veux dire par la que tu n'as toujours pas d'espaces entre les mots ?

  13. #13
    Expert éminent sénior
    Avatar de Emmanuel Delahaye
    Profil pro
    Retraité
    Inscrit en
    Décembre 2003
    Messages
    14 512
    Détails du profil
    Informations personnelles :
    Âge : 67
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Décembre 2003
    Messages : 14 512
    Points : 20 985
    Points
    20 985
    Par défaut
    Citation Envoyé par cyrine Voir le message
    non ca fonctionne pas, j'attends toujours vos reponses
    Et moi, j'attends toujours un code qui compile...
    Pas de Wi-Fi à la maison : CPL

  14. #14
    Débutant Avatar de étoile de mer
    Profil pro
    Étudiant
    Inscrit en
    Avril 2007
    Messages
    978
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2007
    Messages : 978
    Points : 117
    Points
    117
    Par défaut re
    Citation Envoyé par Lucien63 Voir le message
    Tu veux dire par la que tu n'as toujours pas d'espaces entre les mots ?
    non pas d'espace
    Le jour est le père du labeur et la nuit est la mère des pensées.

  15. #15
    Expert éminent sénior
    Avatar de Emmanuel Delahaye
    Profil pro
    Retraité
    Inscrit en
    Décembre 2003
    Messages
    14 512
    Détails du profil
    Informations personnelles :
    Âge : 67
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Décembre 2003
    Messages : 14 512
    Points : 20 985
    Points
    20 985
    Par défaut
    Citation Envoyé par cyrine Voir le message
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    #include<stdio.h>
    #include<stdlib.h>
    #include<string.h>
     
    #include "table_hash.h"
    Hé bé, on est pas sortis...
    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
     
     
    -------------- Build: Debug in hello ---------------
     
    Compiling: main.c
    C:\dev\hello\main.c:5:24: table_hash.h: No such file or directory
    C:\dev\hello\main.c:10: warning: function declaration isn't a prototype
    C:\dev\hello\main.c: In function `main':
    C:\dev\hello\main.c:19: error: `Liste' undeclared (first use in this function)
    C:\dev\hello\main.c:19: error: (Each undeclared identifier is reported only once
    C:\dev\hello\main.c:19: error: for each function it appears in.)
    C:\dev\hello\main.c:19: error: `L' undeclared (first use in this function)
    C:\dev\hello\main.c:21: error: `TableHash' undeclared (first use in this function)
    C:\dev\hello\main.c:22: error: syntax error before ')' token
    C:\dev\hello\main.c:26: warning: implicit declaration of function `hash_cle'
    C:\dev\hello\main.c:27: error: syntax error before '/' token
    C:\dev\hello\main.c:33: warning: implicit declaration of function `ChercherMotDansTableHash'
    C:\dev\hello\main.c:34: warning: implicit declaration of function `InsertionEnTete'
    C:\dev\hello\main.c:38: warning: implicit declaration of function `PosLigne'
    C:\dev\hello\main.c:40: error: syntax error before '/' token
    C:\dev\hello\main.c:42: warning: implicit declaration of function `FiltreListe'
    C:\dev\hello\main.c:43: warning: implicit declaration of function `AfficherTableHash'
    C:\dev\hello\main.c:45: error: syntax error before '/' token
    C:\dev\hello\main.c:45: error: stray '\233' in program
    C:\dev\hello\main.c:45:20: invalid suffix "seq" on integer constant
    C:\dev\hello\main.c:47: warning: implicit declaration of function `Generer2seq'
    C:\dev\hello\main.c:47: error: `seq' undeclared (first use in this function)
    C:\dev\hello\main.c:49: warning: implicit declaration of function `AfficherListe'
    C:\dev\hello\main.c:50: error: syntax error before '/' token
    C:\dev\hello\main.c:56: warning: format argument is not a pointer (arg 2)
    C:\dev\hello\main.c:18: warning: unused variable `seuil'
    C:\dev\hello\main.c: At top level:
    C:\dev\hello\main.c:64: error: syntax error before '*' token
    C:\dev\hello\main.c:64: warning: function declaration isn't a prototype
    C:\dev\hello\main.c: In function `ParcourirElementTableHash':
    C:\dev\hello\main.c:66: error: `Liste' undeclared (first use in this function)
    C:\dev\hello\main.c:66: error: `p' undeclared (first use in this function)
    C:\dev\hello\main.c:67: error: `mot' undeclared (first use in this function)
    C:\dev\hello\main.c:69: error: `TableHash' undeclared (first use in this function)
    C:\dev\hello\main.c:72: warning: implicit declaration of function `AfficherCoordonnees'
    C:\dev\hello\main.c: At top level:
    C:\dev\hello\main.c:84: error: syntax error before '*' token
    C:\dev\hello\main.c:84: error: syntax error before '*' token
    C:\dev\hello\main.c:84: warning: return type defaults to `int'
    C:\dev\hello\main.c:84: warning: function declaration isn't a prototype
    C:\dev\hello\main.c:84: error: conflicting types for 'InsertionEnTete'
    C:\dev\hello\main.c:34: error: previous implicit declaration of 'InsertionEnTete' was here
    C:\dev\hello\main.c: In function `InsertionEnTete':
    C:\dev\hello\main.c:85: error: `Liste' undeclared (first use in this function)
    C:\dev\hello\main.c:85: error: `nouveau' undeclared (first use in this function)
    C:\dev\hello\main.c:86: error: syntax error before ')' token
    C:\dev\hello\main.c:87: error: `mot' undeclared (first use in this function)
    C:\dev\hello\main.c:88: error: `L' undeclared (first use in this function)
    C:\dev\hello\main.c: At top level:
    C:\dev\hello\main.c:93: error: syntax error before '*' token
    C:\dev\hello\main.c:93: error: syntax error before '*' token
    C:\dev\hello\main.c:93: warning: return type defaults to `int'
    C:\dev\hello\main.c:93: warning: function declaration isn't a prototype
    C:\dev\hello\main.c: In function `InsertionEnTeteCoordonnee':
    C:\dev\hello\main.c:94: error: `Coordonnees' undeclared (first use in this function)
    C:\dev\hello\main.c:94: error: `nouveau' undeclared (first use in this function)
    C:\dev\hello\main.c:95: error: syntax error before ')' token
    C:\dev\hello\main.c:96: error: `pos' undeclared (first use in this function)
    C:\dev\hello\main.c:97: error: `nl' undeclared (first use in this function)
    C:\dev\hello\main.c:98: error: `C' undeclared (first use in this function)
    C:\dev\hello\main.c: At top level:
    C:\dev\hello\main.c:102: error: syntax error before '*' token
    C:\dev\hello\main.c:102: warning: function declaration isn't a prototype
    C:\dev\hello\main.c:102: error: conflicting types for 'AfficherListe'
    C:\dev\hello\main.c:49: error: previous implicit declaration of 'AfficherListe' was here
    C:\dev\hello\main.c: In function `AfficherListe':
    C:\dev\hello\main.c:103: error: `Liste' undeclared (first use in this function)
    C:\dev\hello\main.c:103: error: `p' undeclared (first use in this function)
    C:\dev\hello\main.c:104: error: `L' undeclared (first use in this function)
    C:\dev\hello\main.c:105: warning: implicit declaration of function `AfficheMot'
    C:\dev\hello\main.c: At top level:
    C:\dev\hello\main.c:110: error: syntax error before '*' token
    C:\dev\hello\main.c:110: warning: function declaration isn't a prototype
    C:\dev\hello\main.c:110: error: conflicting types for 'AfficherCoordonnees'
    C:\dev\hello\main.c:72: error: previous implicit declaration of 'AfficherCoordonnees' was here
    C:\dev\hello\main.c: In function `AfficherCoordonnees':
    C:\dev\hello\main.c:111: error: `Coordonnees' undeclared (first use in this function)
    C:\dev\hello\main.c:111: error: `p' undeclared (first use in this function)
    C:\dev\hello\main.c:112: error: `C' undeclared (first use in this function)
    C:\dev\hello\main.c: At top level:
    C:\dev\hello\main.c:117: error: conflicting types for 'AfficheMot'
    C:\dev\hello\main.c:105: error: previous implicit declaration of 'AfficheMot' was here
    Process terminated with status 1 (0 minutes, 1 seconds)
    50 errors, 20 warnings
    Pas de Wi-Fi à la maison : CPL

  16. #16
    gl
    gl est déconnecté
    Rédacteur

    Homme Profil pro
    Inscrit en
    Juin 2002
    Messages
    2 165
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Juin 2002
    Messages : 2 165
    Points : 4 637
    Points
    4 637
    Par défaut
    Il reste une erreur, ce n'est pas

    mais

    En outre getchar() serait peut être plus simple Non ?

    De plus, tu ne testes pas les valeurs de retour des malloc() et des fopen(), en cas d'échec de ces fonctions (par exemple si le fichier n'existe pas), tu vas tenter d'utiliser un pointeur NULL

    Sinon, serait-il possible d'avoir un fichier text.txt de test ?

  17. #17
    gl
    gl est déconnecté
    Rédacteur

    Homme Profil pro
    Inscrit en
    Juin 2002
    Messages
    2 165
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Juin 2002
    Messages : 2 165
    Points : 4 637
    Points
    4 637
    Par défaut
    Après un rapide coup d'œil, il me semble que le problème n'est pas dans l'affichage de la liste mais dans la création de celle-ci avec la fonction Generer2seq(). Cette fonction ne crée pas deux maillons contenant chacun un des mots mais crée un maillon contenant les deux mots concaténés.

  18. #18
    Débutant Avatar de étoile de mer
    Profil pro
    Étudiant
    Inscrit en
    Avril 2007
    Messages
    978
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2007
    Messages : 978
    Points : 117
    Points
    117
    Par défaut
    Citation Envoyé par gl Voir le message
    Après un rapide coup d'œil, il me semble que le problème n'est pas dans l'affichage de la liste mais dans la création de celle-ci avec la fonction Generer2seq(). Cette fonction ne crée pas deux maillons contenant chacun un des mots mais crée un maillon contenant les deux mots concaténés.
    Alors stp tas une idée comment remedier à ce probleme?
    merci
    Le jour est le père du labeur et la nuit est la mère des pensées.

  19. #19
    Débutant Avatar de étoile de mer
    Profil pro
    Étudiant
    Inscrit en
    Avril 2007
    Messages
    978
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2007
    Messages : 978
    Points : 117
    Points
    117
    Par défaut texte.txt
    Citation Envoyé par gl Voir le message
    Il reste une erreur, ce n'est pas

    mais

    En outre getchar() serait peut être plus simple Non ?

    De plus, tu ne testes pas les valeurs de retour des malloc() et des fopen(), en cas d'échec de ces fonctions (par exemple si le fichier n'existe pas), tu vas tenter d'utiliser un pointeur NULL

    Sinon, serait-il possible d'avoir un fichier text.txt de test ?

    Support for RTSP authentication
    Support for adding subtitles on the fly
    Fixed MPEG-PS duration calculation
    ATSC support for DVB input
    Partial reading support for DVR-ms recordings
    Partial reading support for MXF and GXF fileformat
    Improved support for Flash Video files
    Le jour est le père du labeur et la nuit est la mère des pensées.

  20. #20
    Expert éminent sénior
    Avatar de Emmanuel Delahaye
    Profil pro
    Retraité
    Inscrit en
    Décembre 2003
    Messages
    14 512
    Détails du profil
    Informations personnelles :
    Âge : 67
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Décembre 2003
    Messages : 14 512
    Points : 20 985
    Points
    20 985
    Par défaut
    Citation Envoyé par cyrine Voir le message
    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
    #ifndef TABLE_HASH
    #define TABLE_HASH
     
    typedef struct c{
    	int pos;
    	int nl;
    	struct c *suivant;
    }Coordonnees;
     
    typedef struct L{
    	char mot[50];
    	Coordonnees *c;
    	struct L *suivant;
    }Liste;
     
     
    Liste *InsertionEnTete(Liste *L,char *mot);
    Coordonnees *InsertionEnTeteCoordonnee(Coordonnees *C,int nl,int pos);
    void AfficherListe(Liste *L);
    void AfficherCoordonnees(Coordonnees *C);
    void AfficheMot(char *mot);
    unsigned int hash_cle(char *mot);
    void AfficherTableHash(Liste **TableHash);
    unsigned int ChercherMotDansTableHash(Liste **TableHash,char *mot);
    void PosLigne(FILE *F,Liste **TableHash);
    void frequent( Liste **TableHash , int mc);
    void ParcourirElementTableHash(Liste **TableHash,char *mot);
    void FiltreListe(Liste **L, int seuil);
    void Generer2seq(Liste **TableHash, int seuil, Liste **seq);
    #endif
    OK. Il reste des choses à corriger
    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
     
    -------------- Build: Debug in hello ---------------
     
    Compiling: main.c
    C:\dev\hello\main.c:9: warning: function declaration isn't a prototype
    C:\dev\hello\main.c: In function `main':
    C:\dev\hello\main.c:25: warning: passing arg 1 of `hash_cle' discards qualifiers from pointer target type
    C:\dev\hello\main.c:66: warning: format argument is not a pointer (arg 2)
    C:\dev\hello\main.c:17: warning: unused variable `seuil'
    C:\dev\hello\main.c:18: warning: unused variable `L'
    C:\dev\hello\main.c:16: warning: 'c' might be used uninitialized in this function
    C:\dev\hello\main.c: In function `Generer2seq':
    C:\dev\hello\main.c:205: warning: unused variable `nb'
    Linking console executable: bin\Debug\hello.exe
    Output size is 27.68 KB
    Process terminated with status 0 (0 minutes, 1 seconds)
    0 errors, 7 warnings
    Pas de Wi-Fi à la maison : CPL

Discussions similaires

  1. Problème affichage d'une liste chainée
    Par Nardjesse dans le forum Débuter
    Réponses: 8
    Dernier message: 06/01/2013, 11h51
  2. Réponses: 0
    Dernier message: 13/12/2010, 09h34
  3. Affichage du contenu d'une AWT List
    Par NaZeF dans le forum Interfaces Graphiques en Java
    Réponses: 2
    Dernier message: 02/03/2010, 11h34
  4. Réponses: 12
    Dernier message: 03/07/2008, 13h53
  5. manipulation d'une liste chainé
    Par sorari dans le forum C++
    Réponses: 1
    Dernier message: 16/03/2005, 12h32

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