Exemplo n.º 1
0
int main() {
    Elem n1 = Elem(12, NULL);
    Elem n2 = Elem(99, NULL);
    Elem n3 = Elem(37, NULL);
    Queue q = Queue();

    q.Insert(n1);
    q.Insert(n2);
    q.Insert(n3);

    q.Print();

    Elem *n;
    while (!q.Empty()) {
        n = q.RemoveFirst();
        cout << "remove " << n->state << endl;
    }
}
Exemplo n.º 2
0
int main(int argc, char** argv)
{
    int x;
    Queue<int>* q = new Queue<int>();
    
    for(int i = 0; i < 5; i++) {
        q->Insert(i);
    }
    
    cout << "> ";
    while( (x = q->Retrieve()) != -1 ) {
        cout << x << " >";
    }
    
    delete q;
    return 0;
}
Exemplo n.º 3
0
int main(int argc, char *argv[])
{
	
	Queue<int> queue;
	for(int i=0; i<10; i++)
	{
		queue.Insert(i);
		std::cout<<i<<" ";
	}
	std::cout<<std::endl;
	std::cout<<"Delete test: ";

	std::cout<<"isEmpty: "<<queue.isEmpty()<<std::endl;

	std::cout<<"length: "<<queue.Length()<<std::endl;

	PrintQueue(queue);

	std::cout<<"isEmpty: "<<queue.isEmpty()<<std::endl;

	std::system("pause");
	return 0;
}