do while getting stuck

Hey, I'm writing this program to simulate 3 queues as parking garages, where C moves to B if a spot opens, and B moves to A if a spot opens. I'm using a do while, and it loops fine when I'm adding cars to the garages, but once I remove a car, the program stops running. I assume the problem is going to be in my DEPART CODE section.

/*This is the PRIMARY FILE for the garage project.
=============================================================*/

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

const int maxqueue = 5;
class queue_type
{
public:
	void clear_queue();
	bool empty_queue();
	bool full_queue();
	void insert_queue(int numb);
	void delete_queue(int& numb);
	int queue[6];
	int front, rear;
};
	queue_type a, b, c, a2, b2, c2;

//=============================================================

int main()
{
	int x = 0;
	int q = 0; //temp value for queue popping
	char n; //n is arrive, depart, or exit;  x is numb number
	a.clear_queue();
	b.clear_queue();
	c.clear_queue();
	a2.clear_queue();
	b2.clear_queue();
	c2.clear_queue();

	//=============================================================
	// STARTUP CODE
	//=============================================================
	do
	{
	cout << "               Is a vehicle arriving or departing?\n" << endl;
	cout << "Car Arriving : A   ||   Car Departing : D   ||   Exit : X" << endl;
	cout << "Enter selection letter ==> ";
	cin >> n;



	if ((!(n=='x')) && (!(n=='X')))
	{
			cout << "\nEnter a license number ==> ";
			cin >> x;
	}


	//=============================================================
	// ARRIVE CODE
	//=============================================================
	while ((n=='a') || (n=='A'))
	{
	if (!(a.full_queue()))
	{
		a.insert_queue(x);
		cout << "Vehicle has been parked in Garage 1." << endl;
		cout << "============================================================================" << endl << endl;
		break;
	}
	else if (!(b.full_queue()))
	{
		b.insert_queue(x);
		cout << "Knockemdead garage is full.  Vehicle has been parked in Garage 2." << endl;
		cout << "============================================================================" << endl << endl;
		break;
	}
	else if (!(c.full_queue()))
	{
		c.insert_queue(x);
		cout << "Both garages are full.  Vehicle has been parked on the street." << endl;
		cout << "============================================================================" << endl << endl;
		break;
	}
	else 
	{
		cout << "All garages and the street are full." << endl << endl;
		cout << "============================================================================" << endl << endl;
		break;
	}
	}//End while

	//=============================================================
	// DEPART CODE
	//=============================================================
	while ((n=='d') || (n=='D')) //n is decision, x is plate number
	{
		while (!(a.empty_queue()))
		{
			a.delete_queue(q);
			a2.insert_queue(q);
		}//end while

		while (!(b.empty_queue()))
		{
			b.delete_queue(q);
			b2.insert_queue(q);
		}//end while

		while (!(c.empty_queue()))
		{
			c.delete_queue(q);
			c2.insert_queue(q);
		}//end while

		while (!(a2.empty_queue())) //A queue filling
		{
			a2.delete_queue(q);
				if (x == q)
				{
					cout << "Car with plate " << x << " has left Garage 1." << endl;
				}
				else
				{
					a.insert_queue(q);
				}//endelse
		}//endwhile

		while (!(b2.empty_queue())) //B queue filling
		{
			b2.delete_queue(q);
				if (x == q)
				{
					cout << "Car with plate " << x << " has left Garage 2." << endl;
				}
				else
				{
					while (!(a.full_queue()))
					{
						a.insert_queue(q);
					}

					while (a.full_queue())
					{
						b.insert_queue(q);
					}
				}//endelse
		}//endwhile

		while (!(c2.empty_queue())) //C queue filling
		{
			c2.delete_queue(q);
				if (x == q)
				{
					cout << "Car with plate " << x << " has left the street." << endl;
				}
				else
				{
					while (!(b.full_queue()))
					{
						b.insert_queue(q);
					}

					while (b.full_queue())
					{
						c.insert_queue(q);
					}
				}//endelse
		}//endwhile
	}

	}//end do
	while ((!(n == 'x')) && (!(n == 'X')));


	return 0;
}

//=============================================================
void queue_type::clear_queue()
{
	front = maxqueue;
	rear = maxqueue;
}
//=============================================================
bool queue_type::empty_queue()
{
	if (rear == front)
		return true;
	else
		return false;
}
//=============================================================
bool queue_type:: full_queue()
{
	int querear;
	if (rear == maxqueue)
		querear = 0;
	else
		querear = rear + 1;
	if (querear == front)
		return true;
	else
		return false;
}
//=============================================================
void queue_type::insert_queue(int numb)
{
	if (rear == maxqueue)
		rear = 0;
	else
		rear = rear + 1;
	queue[rear] = numb;
}
//=============================================================
void queue_type::delete_queue(int& numb)
{
	if (front == maxqueue)
		front = 0;
	else
		front = front + 1;
	numb = queue[front];
}
//=============================================================
Topic archived. No new replies allowed.