//I need help on where to go from here, mostly in the main.
//The instructions and requirements can be found in the attachment.

/*********************************
        Queue header file
********************************/

#ifndef QUEUE_H
#define QUEUE_H

#include <iostream>
using namespace std;

class Queue
{
private:
    class QueueNode
    {
        friend class Queue;
        int value;
        QueueNode *next;
        QueueNode(int value1, QueueNode *next1 = NULL)
        {
            value = value1;
            next = next1;
        }
    };
    QueueNode *front;
    QueueNode *rear;
public:
    Queue();
   ~Queue();

    void enqueue(int);
    void dequeue(int &);
    bool isEmpty();
    void clear();

};

#endif

/**********************************
         Queue cpp
***********************************/

#include <iostream>
#include <iomanip>

#include "queue.h"
using namespace std;

Queue::Queue ()
{
    front = NULL;
    rear = NULL;
}

Queue::~Queue()
{
    clear();
}

void Queue::enqueue(int num)
{
   if (isEmpty())
   {
       front = new QueueNode(num);
       rear = front;
   }
}

void Queue::dequeue(int &num)
{   
    QueueNode *temp;
    if (isEmpty())
    {
        cout<<"The queue is empty.\n";
        exit(1);
    }
    else
    {
        num = front->value;
        temp=front;
        front=front->next;
        delete temp;
    }
}

bool Queue::isEmpty()
{
   if (front == NULL)
       return true;
   else 
       return false;
}

void Queue::clear()
{
    int value;
    while(!isEmpty())
        dequeue(value);
}

/***************************
       main cpp
***************************/

#include <iostream>
#include <iomanip>
using namespace std;

#include <time.h>     
#include "queue.h"

int main()
{
    int option;
    Queue iQueue;
    int num = 1;

    long seconds;
    seconds = static_cast<long>(time(NULL));

    cout<<"The line is empty"<<endl;
    do {
    cout<<"Enter '1' to simulate a customer's arrival, '2' to help the next customer, or '3' to quit"<<endl;
    cin>>option;

    if (option == 1)
    {

        cout<<"Customer "<< num <<" entered the queue at time "<<seconds<<endl;
            iQueue.enqueue(num);
            num++;
    }

    else if (option == 2)
    {
        cout<<"Customer "<< num <<" is being helped at time "<<seconds<<endl;
        //cout<<"Wait time = "<<  <<"seconds "<<endl;

    }

    else 
    {
        break;
    }

    }while (option != 3);

    while (!iQueue.isEmpty())
    {
        int value;
        iQueue.dequeue(value);
        cout<<value<<" ";

    }

    system("pause");
     return 0;
}  

Customers need to be numbered and put in waiting room status, and then as windows are free, assigned to windows sequentially. One behavior is the number and add to tail (take a ticket), and the other is to read and delete from head (now serving #N). Now, the waiting room could be any container type, or just a pair of counters, the input counter (ticket roll) and the output counter (now serving display). Containers would be overkill, until you grow more requirements.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.