测试队列的实例

来源:互联网 发布:部落冲突10本满防数据 编辑:程序博客网 时间:2024/06/07 09:03
/*_############################################################################
  _##
  _##  测试队列的实例
  _##  Author: xwlee                        
  _##  Time: 2006.12.31 
  _##  Chang'an University
  _##  Development condition: win2003 Server+VC6.0
  _##
  _##  temp.cpp 文件
  _##########################################################################*/
#include<iostream>
#include <ctime>
#include <iomanip>
#include "stack.h"
using namespace std;

#define TEMP_SIZE 10

int main()
{  
    QUEUE_TYPE temp=100;
//    int i;

     myinsert( 40 );
    myinsert( 50 );
    myinsert( 60 );
    myinsert( 70 );
    myinsert( 80 );
    cout << "is_full()=" << is_full() << endl;

    cout << "first()=" << first() << endl;
    mydelete();
    cout << "first()=" << first() << endl;
    mydelete();
    cout << "first()=" << first() << endl;
    mydelete();
    cout << "first()=" << first() << endl;
    mydelete();
    cout << "first()=" << first() << endl;
    mydelete();
cout<< "=======================================================" << endl;

     myinsert( 140 );
    myinsert( 150 );
    myinsert( 160 );
    myinsert( 170 );
    myinsert( 180 );
    cout << "first()=" << first() << endl;
    mydelete();
    cout << "first()=" << first() << endl;
    mydelete();
    cout << "first()=" << first() << endl;
    mydelete();
    cout << "first()=" << first() << endl;
    mydelete();
    cout << "first()=" << first() << endl;
    mydelete();



    cout << "is_empty()=" << is_empty() << endl;
    cout << "is_full()=" << is_full() << endl;


   
/*    srand( (unsigned)time( NULL ) ); // srand()函数产生一个以当前时间开始的随机种子.
    for(i=0; i < TEMP_SIZE; i++)
        myinsert( 1+i );
       
    for(i=0; i < TEMP_SIZE; i++)
    {
        cout << setw(5) << first();
        mydelete();
        if( (i+1) % 10 == 0 )
            cout << endl;
    }
*/
    cout<< "=======================================================" << endl;
   
    cout << "is_empty()=" << is_empty() << endl;
    cout << "is_full()=" << is_full() << endl;
   
    return 0;
}
原创粉丝点击