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

📄 intlist.hpp

📁 这是遗传算法的源代码
💻 HPP
字号:
// -*- c++ -*-////  File:         intlist.hpp////  Description:  C++ interface to the class intList, a list of integers.////  Author:       Fernando Lobo////  Date:         June/1999////  Extended to deal with chi-ary problems by Luis de la Ossa//  GCC 3.4 and 4 series compliance by Kumara Sastry ////  Date:         March/2006#ifndef _intlist_hpp#define _intlist_hpp#include <iostream>//#include "util.hpp"  // a list elementtypedef struct intListElem {  int    x;   } intListElem;// creates an element of the listvoid make_intlistelem( intListElem &elem, int x );// a list node (contains an element and a pointer to the next element)class intListNode {    friend class intList;  private:    intListNode( intListElem e, intListNode *u = 0 ) { elem = e; next = u; }  public:    intListElem elem;         intListNode *next;    };// class list of nodesclass intList{  private:    int size;     intListNode *list;  public:    intList() { size = 0; list = 0; }    ~intList();    intList & operator=(intList &L);      int length() { return size; }    void insert( intListElem elem );    void insert( int x );    void insertAtEnd( intListElem elem );    void insertAtEnd( int x );    intListElem get();    intListElem remove();    void remove(int x);    bool is_empty();    void asArray( int *A );    void display();    friend std::ostream &operator<< (std::ostream &out, intList &L);    void intersection( intList &L1, intList &L2 );    bool hasMember( intListElem elem );};#endif

⌨️ 快捷键说明

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