⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ilist_main.c

📁 适合中高级学习的人参考使用的c++程序代码
💻 C
字号:
#include <iostream.h>
#include "ilist.h"

int main()
{
    ilist mylist;

    for ( int ix = 0; ix < 10; ++ix ) {
	  mylist.insert_front( ix );
          mylist.insert_end( ix );
    }

    cout << "Ok: after insert_front() and insert_end()\n"; 
    mylist.display();

    ilist_item *it = mylist.find( 8 );
    cout << "\n" 
	 << "Searching for the value 8: found it?"
	 << ( it ? " yes!\n" : " no!\n" );

    mylist.insert( it, 1024 );
    cout << "\n" 
	 << "Inserting element 1024 following the value 8\n";
    mylist.display();

    int elem_cnt = mylist.remove( 8 );
    cout << "\n" 
	 << "Removed " << elem_cnt << " of the value 8\n";

    mylist.display();

    cout << "\n" << "Removed front element\n"; 
    mylist.remove_front(); mylist.display();

    cout << "\n" << "Removed all elements\n"; 
    mylist.remove_all(); mylist.display();
}

⌨️ 快捷键说明

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