0
1.7kviews
Write a program to implement a queue using an array.
1 Answer
0
3views

Program:

#include<iostream>
#include<conio.h>
using namespace std;

class Queue
{
    int arrQueue[10];
    int rear,front;
    public:
    Queue()
    {
    rears=-1;
    front=-1;
    }

    //This function is used to insert an element in queue
    void insert(int el)
    {
        if(isFull())
        {
            cout <<"Queue is full!";
            front=rear=-1;
            return;
        }
        arrQueue[++rear]=el;
        if(front==-1)
            front = 0;
        cout <<"Element inserted …

Create a free account to keep reading this post.

and 4 others joined a min ago.

Please log in to add an answer.