prg9_7b.cpp

来自「Data Structures with C++附代码」· C++ 代码 · 共 33 行

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

// include the linked list implementation of the SeqList
#include "seqlist1.h"

void main(void)
{
    // define an integer list
    SeqList<int> 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.7b>

Program begin!
Program done!   // 4 seconds
*/

⌨️ 快捷键说明

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