driver.cpp
来自「经典vc教程的例子程序」· C++ 代码 · 共 52 行
CPP
52 行
// Queue test program
#include <iostream.h>
#include "queue.h"
int main()
{
Queue<int> intQueue;
cout << "Inserting integers on intQueue" << endl;
for ( int i = 0; i < 5; i++ ) {
intQueue.enqueue( i ); // put items in the queue
cout << i << ' ';
}
cout << endl;
intQueue.print(); // output the queue contents
cout << endl << "Deleting integers from intQueue" << endl;
while ( !intQueue.isEmpty() )
cout << intQueue.dequeue() << ' '; // remove items
cout << endl;
intQueue.print(); // output the queue contents
Queue<char> charQueue;
cout << endl << endl
<< "Inserting characters on charQueue" << endl;
for ( char c = 'A'; c < 'E'; c++ ) {
charQueue.enqueue( c ); // put items in the queue
cout << c << ' ';
}
cout << endl;
charQueue.print(); // output the queue contents
cout << endl << "Deleting characters from charQueue" << endl;
while ( !charQueue.isEmpty() )
cout << charQueue.dequeue() << ' '; // remove items
cout << endl;
charQueue.print(); // output the queue contents
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?