~cpp
class Queue
{
enum {Size=100};
private:
int m_nFront;
int m_nRear;
int m_nData[Size];
bool IsEmpty();
bool IsFull();
public:
Queue() {m_nFront=m_nRear=-1;}
bool Add(int ndata);
bool Erase();
void Show();
~Queue() {}
};
bool Queue::IsEmpty()
{
true;
return false;
}
bool Queue::IsFull()
{
if(m_nRear==Size-1 && m_nFront!=m_nRear)
return true;
return false;
}
bool Queue::Add(int ndata)
{
if(!IsFull())
{
m_nData[++m_nRear]=ndata;
return true;
}
else
{
cout<<"���������";
return false;
}
}
bool Queue::Erase()
{
if(!IsEmpty())
{
m_nFront++;
return true;
}
else
{
cout<<"���������";
return false;
}
}
void Queue::Show()
{
int count=m_nFront;
while(1)
{
cout<<m_nData[++count];
if(count==m_nRear)
break;
}
}
- ���������.. ��� 큐��� ������������ ������������.
- ��������� 한 90��� ������ ��� ��������� 90��� ������������? Front��� Rear��� ������ 89��� ������키��� ������������? ������ ������ ��������� 10-_-��������� ������������.
- ��������� ������ ������ 100������ ��������� 할���해������������ 90������ ��� ������ ������������.
- ������ ������하��� ���해 ���형 큐��������� ���������������. ������ ���크��� ������트��� 큐��� ������������ ���한������ ������ ��������� ���������.
- ��������� ���������������������?^^