Skip to content
View Khushboo741's full-sized avatar

Block or report Khushboo741

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
Khushboo741/README.md
  • 👋 Hi, I’m @Khushboo741
  • 👀 I’m interested in ...
  • 🌱 I’m currently learning ...
  • 💞️ I’m looking to collaborate on ...
  • 📫 How to reach me ...

#include #include<conio.h> #include<stdlib.h>

#define MAX_SIZE 100

using namespace std;

class Queue { private: int item, i; int arr_queue[MAX_SIZE]; int rear; int front;

public:

Queue() {
    rear = 0;
    front = 0;
}

void insert() {
    if (rear == MAX_SIZE)
        cout << "\n## Queue Reached Max!";
    else {
        cout << "\nEnter The Value to be Insert : ";
        cin>>item;
        cout << "\n## Position : " << rear + 1 << " , Insert Value  : " << item;
        arr_queue[rear++] = item;
    }
}

void removeData() {
    if (front == rear)
        cout << "\n## Queue is Empty!";
    else {
        cout << "\n## Position : " << front << " , Remove Value  :" << arr_queue[front];
        front++;
    }
}

void display() {
    cout << "\n## Queue Size : " << (rear - front);
    for (i = front; i < rear; i++)
        cout << "\n## Position : " << i << " , Value  : " << arr_queue[i];
}

};

int main() { int choice, exit_p = 1; Queue obj; cout << "\nSimple Queue Example - Class and Memeber Functions in C++"; do { cout << "\n\n Queue Main Menu";

    cout << "\n1.Insert \n2.Remove \n3.Display \nOthers to exit";
    cout << "\nEnter Your Choice : ";
    cin>>choice;
    switch (choice) {
        case 1:
            obj.insert();
            break;
        case 2:
            obj.removeData();
            break;
        case 3:
            obj.display();
            break;
        default:
            exit_p = 0;
            break;
    }
} while (exit_p);

return 0;

}

Popular repositories Loading

  1. Stack Stack Public

  2. Khushboo741 Khushboo741 Public

    Config files for my GitHub profile.

  3. Queue Queue Public

  4. day3 day3 Public

  5. day-4 day-4 Public

  6. Day-5 Day-5 Public