I'm trying to create a simulation for a service line at a super market. The program builds just fine, but when I run it, I get:

"Debug Assertion Failed!

Program:...
File:c:\program files\microsoft visual studio 8\vc\include\deque
Line: 97

Expression: deque iterator not dereferencable"

#include "stdafx.h"
#include <iostream>
#include <queue>
#include <cstdlib>
#include <ctime>

using namespace std;

//for readability later
#define RANDFOUR (rand()%4+1)

int main()
{
	//seeding for random variables
	srand(time(0));

	//Queue declarations, didn't paste irrelevant stuff
	queue<int> ServiceQueue;

	//variable declarations, didn't paste irrelevant stuff
	int TimeCount=0;//counter for how many minutes have elapsed
	int NextArrival=RANDFOUR;//assigns 1-4 min for arrival of costumer

	while (TimeCount<720)
	{
		//if it's time for the next costumer to arrive.
		if (TimeCount==NextArrival)
		{
			
		}

		//if service is over for the current costumer
		if (ServiceQueue.front()==0)
		{
			
		}
		else//if service is not yet over for the current costumer
		{
			
		}

		++TimeCount;
	}

	//irrelevant stuff	

	//output
	
	return 0;
}

By debuging using cout statements, I figured that the program works fine until just before:

if(TimeCount==NextArrival)

but I'm not sure why. =( Can someone help?

Nevermind, got it.

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.