Queue L question and input output specification are in the p


Queue L
question and input output specification are in the picture

in great need for answer in c programing language

which can output as the sample output when there is sample input as the picture shows, according to the question
T T

and so many time someone give me the ans that need more info but didnt tell me what info he need.. it makes me really down
..sorry i really dont have other infoT_T

thx for ur kindly help_



Question: [Stand in a queue] Content In the real world, e hve to Iine u d a qeve hen lielo lle iJul gp.ier. A-su, yueue\'s wr-..tri rieev IU Je considcred, such as brirz enpty ar ful eraser ns, irt the uhele ueue eleTent Input: 1 lire isieger the queue hes N urbers Fron 31 line to EOF (End of File) Enqueue 1 1s ollawe hy he taraet insert nuter Dequeu TnFIT the r.inner4,111 delete the t1-st ill.nbar·n the quFIF

Solution

Try this program,

#include<conio.h>

#include<stdio.h>

#define max 5

int queue[max],front=0,rear=0;

int menu();

void enqueue();

void dequeue();

void display();

void main()

{

int ch;

clrscr();

printf(\"\ ProgrammingUnit.com - Free Source Codes\ \");

printf(\"\ Queues using Arrays\ \");

do

{

    ch=menu();

    switch(ch)

    {

    case 1: enqueue();

    break;

    case 2: dequeue();

    break;

    case 3: display();

    break;

    case 4: exit();

    break;

    default:printf(\"\ Please enter a valid choice!!\");

    }

}while(1);

}

int menu()

    {

    int ch;

    printf(\"\ 1.ENQUEUE \ 2.DEQUEUE \ 3.DISPLAY \ 4.EXIT\");

    printf(\"\ Enter your Choice:\");

    scanf(\"%d\",&ch);

    return ch;

    }

void enqueue()

{

    int element;

    if(rear==max)

    {

        printf(\"\ Overflow!!\");

    }

    else

    {

        printf(\"\ Enter Element:\");

        scanf(\"%d\",&element);

        queue[rear++]=element;

        printf(\"\ %d Enqueued at %d\",element,rear);

    }

}

void dequeue()

{

    if(rear==front)

    {

        printf(\"\ Underflow!!\");

    }

    else

    {

        front++;

        printf(\"\ Element is Dequeued from %d\",front);

    }

}

void display()

{

    int i;

    if(front==rear)

    {

        printf(\"\ Queue is Empty!!!\");

    }

    else

    {

        printf(\" \ \");

        for(i=front;i<max;i++)

        {

            printf(\" | %d \",queue[i]);

        }

            printf(\"|\");

    }

}

Thank you!

 Queue L question and input output specification are in the picture in great need for answer in c programing language which can output as the sample output when
 Queue L question and input output specification are in the picture in great need for answer in c programing language which can output as the sample output when
 Queue L question and input output specification are in the picture in great need for answer in c programing language which can output as the sample output when

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site