// Main file for demo of Abstract Data Types
// This uses a queue and tests some of its basic functions
// Marc Chee 18/4/2019

#include <stdio.h>
#include "queue.h"

int main(void) {
    printf("Creating a queue.\n");
    queue pokeParade = queueCreate();
    
    int poke = 1;
    printf("Adding %d to the queue.\n", poke);
    queueAdd(pokeParade, poke);
    
    poke = 2;
    printf("Adding %d to the queue.\n", poke);
    queueAdd(pokeParade, poke);

    poke = 3;
    printf("Adding %d to the queue.\n", poke);
    queueAdd(pokeParade, poke);
    
    printf("There are %d Pokemon in the parade.\n", queueSize(pokeParade));
    while(queueSize(pokeParade) > 0) {
        printf("Pokemon ID: %d just walked past.\n", queueRemove(pokeParade));
    }
    
    queueFree(pokeParade);

    return 0;
}

Resource created Tuesday 23 April 2019, 01:56:24 AM, last modified Wednesday 24 April 2019, 03:39:26 PM.

file: main.c


Back to top

COMP1511 19T1 (Programming Fundamentals) is powered by WebCMS3
CRICOS Provider No. 00098G