Error:
Debug Assertion failed: Expression: BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
Code:
#include "stdafx.h"
#include<iostream>
#include<stdlib.h>
#using <System.dll>
#include< math.h>
#include< time.h>
#include<List>
using namespace System;
using namespace System::Collections::Generic;
using namespace System::Linq;
int someSize=2000;
# define SIZE 20
class queue
{
int aMsg[SIZE];
int front;
int rear;
public:
queue();
~queue();
void insertMessage(int i);
int removeMessage();
int isempty();
int isfull();
void displayitem();
};
queue::queue()
{
front=0;
rear=0;
}
queue::~queue()
{
delete []aMsg;
}
void queue::insertMessage(int i)
{
if(isfull())
{
Console::WriteLine("******Queue is FULL !!!No insertion allowed further.******");
return;
}
aMsg[rear] = i;
rear++;
}
int queue::removeMessage()
{
if(isempty())
{
Console::WriteLine("******Queue Empty !!!Value returned will be garbage.******");
return (-9999);
}
return(aMsg[front++]);
}
int queue::isempty()
{
if(front == rear)
return 1;
else
return 0;
}
int queue::isfull()
{
if(rear == SIZE)
return 1;
else
return 0;
}
void queue::displayitem()
{
if(isempty())
Console::WriteLine("****Empty*****");
else
for(int i=front; i!=rear; i++)
Console::WriteLine("the queue is having item {0}", aMsg[i]);
}
int main(array<System:: String ^> ^args)
{
Console::WriteLine(L"Hello World");
queue q;
q.insertMessage(3);
q.insertMessage(4);
Console::WriteLine("the queue removed item {0}",q.removeMessage());
//q.displayitem();
return 0;
}