Selling Simple Queue Assignment in C

Discussion in 'Programming' started by itisme1760, Nov 18, 2010.

  1. #1
    Provides a simple queueing application, where each line of the input is read into a queue. The queue is then printed and the program stops. The idea of a stub is introduced. Incomplete code is just rep- resented by a print statement which must eventually be replaced by actual code. The following com- mand will tell you where all of the stub calls are : grep STUB *.[hc]

    You must implement new_queue, insert_queue, remove_queue. Make sure your implementation is done via the several files, whose object modules are linked together into a single executable.

    Most of the code is already written, just need to implement 3 functions.

    Job for quick $10 via Paypal, PM me ASAP! It will only take like 10-15 minutes of your time. Someone with Skype or AIM or MSN preferred so we can discuss this.

    Code that needs to be added to (whereever it says STUBPRINTF)
    /* $Id: queue.c,v 1.5 2010-11-04 19:28:48-07 - - $ */
    
    #include <assert.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    #include "queue.h"
    
    static char *queue_tag = "struct queue";
    static char *queuenode_tag = "struct queuenode";
    
    typedef struct queuenode *queuenode_ref;
    
    struct queuenode {
       char *tag;
       queue_item_t item;
       queuenode_ref link;
    };
    
    struct queue {
       char *tag;
       queuenode_ref front;
       queuenode_ref rear;
    };
    
    queue_ref new_queue (void) {
       STUBPRINTF ("return NULL\n");
       return NULL;
    }
    
    void free_queue (queue_ref queue) {
       assert (is_queue (queue));
       assert (isempty_queue (queue));
       xmemset (queue, 0, sizeof (struct queue));
       free (queue);
    }
    
    void insert_queue (queue_ref queue, queue_item_t item) {
       assert (is_queue (queue));
       STUBPRINTF ("item =\n\t\"%s\"\n", item);
    }
    
    queue_item_t remove_queue (queue_ref queue) {
       assert (is_queue (queue));
       assert (! isempty_queue (queue));
       STUBPRINTF ("return NULL\n");
       return NULL;
    }
    
    bool isempty_queue (queue_ref queue) {
       assert (is_queue (queue));
       return queue->front == NULL;
    }
    
    bool is_queue (queue_ref queue) {
       return queue != NULL && queue->tag == queue_tag;
    }
    
    
    Code (markup):

     
    Last edited: Nov 18, 2010
    itisme1760, Nov 18, 2010 IP
  2. magam

    magam Active Member

    Messages:
    151
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    hi,
    I can complete this program for u..

    my id:
     
    magam, Nov 18, 2010 IP