support@qualityresearchpapers.com

+1(316)4441378

+44-141-628-6690

Our Services

Assignment With Help Of C Programming

#include <stdio.h>

#include <stdlib.h>

#include <stdbool.h>

#define MAX 6 

int itemCount = 0;

void Print(int intArray[]);

int peek(int intArray[]) {

    return intArray[0];

}

bool isEmpty(int intArray[]){

    return itemCount == 0;

}

bool isFull(int intArray[]){

    return itemCount == MAX;

}

int size(){

    return itemCount;

}

void enQueue(int data, int intArray[]){

    if(!isFull(intArray)) {

        intArray[size()] = data;

        itemCount++;

    }

    else

    {

        printf(“Error: The queue is full.n”);

    }

}

int deQueue(int intArray[]){

    int data = -1;

    if(isEmpty(intArray)) {

        printf(“Error: The queue is empty.n”);

    }

    else

    {

        data = intArray[0];

        for(int i = 0; i < MAX-1; i++)

        {

            intArray[i] = intArray[i+1];

        }

        itemCount–;

    }

    

    return data;

    

}

int main() {

    

    int intArray[MAX] = {0,0,0,0,0,0};

    //USE max

    for(int i = 0; i < MAX+1; i++)

    {

        printf(“EnQueue %dn”, i*3);

        enQueue(i*3, intArray);

        Print(intArray);

    }

    for(int i = 0; i < MAX+1; i++)

    {

        int data = deQueue(intArray);

        printf(“DeQueue %dn”, data);

        Print(intArray);

    }

    return (EXIT_SUCCESS);

}

void Print(int intArray[])

{

    printf(“size : %dn”, size());

    printf(“——————————–n”);

    printf(“index : “);

    for(int iter=0; iter<size(); iter++)

    {

        printf(“dt”, iter);

        

    }

    printf(“n—————————n”);

    printf(“queue : “);

    for(int iter= 0; iter < size(); iter++)

    {

        printf(“%dt”, intArray[iter]);

        

    }

    printf(“n————————n”);

}

 

You can place an order similar to this with us. You are assured of an authentic custom paper delivered within the given deadline besides our 24/7 customer support all through.

 

Latest completed orders:

Completed Orders
# Title Academic Level Subject Area # of Pages Paper Urgency
[order_calculator]
Copyright © 2016 Quality Research Papers All Rights Reserved