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 :

porgrammation des files d'attente(methode de PERT)


Sujet :

C

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Septembre 2007
    Messages
    37
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2007
    Messages : 37
    Par défaut porgrammation des files d'attente(methode de PERT)
    bonjour tout le monde ,

    pourriez vous m'aider pour la programmation de la methode de PERT(fille d'attente) en c.

    Je cherche un code sur le web mais j'ai pas trouvé . SVP indiquez moi un lien pour ce probleme ou un code !

    Merci d'avance

  2. #2
    Membre chevronné Avatar de cmoibal
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    361
    Détails du profil
    Informations personnelles :
    Localisation : Tunisie

    Informations forums :
    Inscription : Avril 2007
    Messages : 361
    Par défaut
    salut,

    voici un exemple :

    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
     
     
    void queueInit(queue_t *myroot)
    {
        myroot->head = NULL;
        myroot->tail = NULL;
        myroot->count = 0;
    }
     
    void queuePut(queue_t *myroot, node_t * const mynode)
    {
        mynode->next = NULL;
        if(myroot->tail != NULL)
        {
            assert(myroot->tail != mynode);
            myroot->tail->next = mynode;
        }
        myroot->tail = mynode;
        if(myroot->head==NULL)
            myroot->head = mynode;
        myroot->count++;
    }
     
    node_t *queueGet(queue_t * const myroot)
    {
        node_t *node;
        node = myroot->head;
        if (myroot->head == myroot->tail)
        {
            myroot->tail = NULL;
        }
        if(myroot->head != NULL)
        {
            myroot->head = myroot->head->next;
        }
     
        myroot->count--;
        return node;
    }
     
    void queueDestroy(queue_t *myroot)
    {
        node_t *node;
        while(myroot->head!=NULL)
        {
            node = myroot->head;
            myroot->head = myroot->head->next;
            free(node);
        }
    }

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

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Décembre 2003
    Messages : 14 512
    Par défaut
    Citation Envoyé par cmoibal Voir le message
    salut,

    voici un exemple :
    Correct quand le code est complet...
    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
     
    #include <stdio.h>
    #include <stdlib.h>
    #include <assert.h>
     
    typedef struct node
    {
       int data;
     
       struct node *next;
    }
    node_t;
     
    typedef struct
    {
       node_t *head;
       node_t *tail;
       int count;
    }
    queue_t;
     
    void queueInit (queue_t * myroot)
    {
       myroot->head = NULL;
       myroot->tail = NULL;
       myroot->count = 0;
    }
     
    node_t *node_create (int data)
    {
       node_t *this = malloc (sizeof *this);
     
       if (this != NULL)
       {
          {
             static node_t const z = { 0, NULL };
             *this = z;
          }
          this->data = data;
       }
       return this;
    }
     
    void queuePut (queue_t * myroot, node_t * const mynode)
    {
       mynode->next = NULL;
       if (myroot->tail != NULL)
       {
          assert (myroot->tail != mynode);
          myroot->tail->next = mynode;
       }
       myroot->tail = mynode;
       if (myroot->head == NULL)
          myroot->head = mynode;
       myroot->count++;
    }
     
    node_t *queueGet (queue_t * const myroot)
    {
       node_t *node;
       node = myroot->head;
       if (myroot->head == myroot->tail)
       {
          myroot->tail = NULL;
       }
       if (myroot->head != NULL)
       {
          myroot->head = myroot->head->next;
       }
     
       myroot->count--;
       return node;
    }
     
    void queueDestroy (queue_t * myroot)
    {
       while (myroot->head != NULL)
       {
          node_t *node = myroot->head;
          myroot->head = myroot->head->next;
          free (node);
       }
    }
     
    void queue_print (queue_t * myroot)
    {
       node_t *p = myroot->head;;
       while (p != NULL)
       {
          printf ("%d -> ", p->data);
          p = p->next;
       }
       printf ("NIL\n");
    }
     
    int main (void)
    {
       queue_t queue;
       queueInit (&queue);
     
       {
          node_t *const mynode = node_create (12);
     
          queuePut (&queue, mynode);
       }
       queue_print (&queue);
       {
          node_t *const mynode = node_create (34);
     
          queuePut (&queue, mynode);
       }
       queue_print (&queue);
       {
          node_t *const mynode = node_create (56);
     
          queuePut (&queue, mynode);
       }
       queue_print (&queue);
     
       {
          node_t *mynode = queueGet (&queue);
          printf ("data = %d\n", mynode->data);
          free (mynode);
       }
       queue_print (&queue);
       {
          node_t *mynode = queueGet (&queue);
          printf ("data = %d\n", mynode->data);
          free (mynode);
       }
       queue_print (&queue);
     
       queueDestroy (&queue);
       queue_print (&queue);
     
       return 0;
    }
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
    12 -> NIL
    12 -> 34 -> NIL
    12 -> 34 -> 56 -> NIL
    data = 12
    34 -> 56 -> NIL
    data = 34
    56 -> NIL
    NIL
     
    Press ENTER to continue.

  4. #4
    Membre chevronné Avatar de cmoibal
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    361
    Détails du profil
    Informations personnelles :
    Localisation : Tunisie

    Informations forums :
    Inscription : Avril 2007
    Messages : 361
    Par défaut
    Citation Envoyé par Emmanuel Delahaye Voir le message
    Correct quand le code est complet...
    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
     
    #include <stdio.h>
    #include <stdlib.h>
    #include <assert.h>
     
    typedef struct node
    {
       int data;
     
       struct node *next;
    }
    node_t;
     
    typedef struct
    {
       node_t *head;
       node_t *tail;
       int count;
    }
    queue_t;
     
    void queueInit (queue_t * myroot)
    {
       myroot->head = NULL;
       myroot->tail = NULL;
       myroot->count = 0;
    }
     
    node_t *node_create (int data)
    {
       node_t *this = malloc (sizeof *this);
     
       if (this != NULL)
       {
          {
             static node_t const z = { 0, NULL };
             *this = z;
          }
          this->data = data;
       }
       return this;
    }
     
    void queuePut (queue_t * myroot, node_t * const mynode)
    {
       mynode->next = NULL;
       if (myroot->tail != NULL)
       {
          assert (myroot->tail != mynode);
          myroot->tail->next = mynode;
       }
       myroot->tail = mynode;
       if (myroot->head == NULL)
          myroot->head = mynode;
       myroot->count++;
    }
     
    node_t *queueGet (queue_t * const myroot)
    {
       node_t *node;
       node = myroot->head;
       if (myroot->head == myroot->tail)
       {
          myroot->tail = NULL;
       }
       if (myroot->head != NULL)
       {
          myroot->head = myroot->head->next;
       }
     
       myroot->count--;
       return node;
    }
     
    void queueDestroy (queue_t * myroot)
    {
       while (myroot->head != NULL)
       {
          node_t *node = myroot->head;
          myroot->head = myroot->head->next;
          free (node);
       }
    }
     
    void queue_print (queue_t * myroot)
    {
       node_t *p = myroot->head;;
       while (p != NULL)
       {
          printf ("%d -> ", p->data);
          p = p->next;
       }
       printf ("NIL\n");
    }
     
    int main (void)
    {
       queue_t queue;
       queueInit (&queue);
     
       {
          node_t *const mynode = node_create (12);
     
          queuePut (&queue, mynode);
       }
       queue_print (&queue);
       {
          node_t *const mynode = node_create (34);
     
          queuePut (&queue, mynode);
       }
       queue_print (&queue);
       {
          node_t *const mynode = node_create (56);
     
          queuePut (&queue, mynode);
       }
       queue_print (&queue);
     
       {
          node_t *mynode = queueGet (&queue);
          printf ("data = %d\n", mynode->data);
          free (mynode);
       }
       queue_print (&queue);
       {
          node_t *mynode = queueGet (&queue);
          printf ("data = %d\n", mynode->data);
          free (mynode);
       }
       queue_print (&queue);
     
       queueDestroy (&queue);
       queue_print (&queue);
     
       return 0;
    }
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
    12 -> NIL
    12 -> 34 -> NIL
    12 -> 34 -> 56 -> NIL
    data = 12
    34 -> 56 -> NIL
    data = 34
    56 -> NIL
    NIL
     
    Press ENTER to continue.
    tu sais quoi, j'ai quoi dire en C moi aussi , ne soit pas si inchenfient !!!!
    c'est un code que j'ai utilisé déja, alors, ....

  5. #5
    Membre chevronné
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    309
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France

    Informations forums :
    Inscription : Juillet 2007
    Messages : 309
    Par défaut
    Ce n'est pas le genre de la maison... Commence par programmer quelque chose, réfléchis, code, réfléchis, code, réfléchis et ensuite si vraiment tu n'arrives pas à régler certains problèmes, demande de l'aide sur les points sur lesquels tu bloques.

Discussions similaires

  1. Gestion des files d'attentes
    Par Djemàa dans le forum MATLAB
    Réponses: 0
    Dernier message: 13/12/2014, 14h25
  2. Théorie des files d'attentes
    Par cyrill.gremaud dans le forum Développement
    Réponses: 0
    Dernier message: 27/11/2011, 19h07
  3. le théorie des files d'attente
    Par ranell dans le forum Développement
    Réponses: 2
    Dernier message: 05/07/2010, 16h19
  4. ActiveMQ suppression des messages en files d'attente
    Par missd12 dans le forum Autres Solutions d'entreprise
    Réponses: 0
    Dernier message: 29/06/2009, 10h24
  5. modification des messages dans la file d'attente de postfix avant l'envoi
    Par navorinco dans le forum Administration système
    Réponses: 4
    Dernier message: 09/03/2009, 16h01

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