0

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?

1
Contributor
1
Reply
2
Views
8 Years
Discussion Span
Last Post by gnit
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.