+1(316)4441378

+44-141-628-6690

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:

# topic title discipline academic level pages delivered
6
Writer's choice
Business
University
2
1 hour 32 min
7
Wise Approach to
Philosophy
College
2
2 hours 19 min
8
1980's and 1990
History
College
3
2 hours 20 min
9
pick the best topic
Finance
School
2
2 hours 27 min
10
finance for leisure
Finance
University
12
2 hours 36 min
[order_calculator]