prg9_7a.cpp

来自「经典数据结构书籍 数据结构C++语言描述 的源代码 很难找的哦」· C++ 代码 · 共 37 行

CPP
37
字号
#include <iostream.h>
#pragma hdrstop

// use DataType = int to store integer values in the list
typedef int DataType;

// include the array-based SeqList class
#include "aseqlist.h"

void main(void)
{
    // a list with capacity 500 integers
    SeqList L;
    long  i;
    
    // initialize the list with values 0 .. 499
    for (i = 0; i < 500; i++)
        L.Insert(int(i));
        
    // exercise the delete/insert operations 50000 times
    cout << "Program begin!" << endl;
    for (i = 1; i <= 50000L; i++)
    {
        L.DeleteFront();
        L.Insert(0);
   }
    cout << "Program done!" << endl;
}

/*
<Run of Program 9.7a>

Program begin!
Program done!       // 55 seconds

*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?