• 大小: 2.91MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-15
  • 语言: C/C++
  • 标签: 图书管理  

资源简介

用C++写的一个很强大的图书管理系统程序,虽然是DOS界面,但是对初学者来说绝对的值

资源截图

代码片段和文件信息


#include 

template 
class SeqList                                    //顺序表类,T指定元素类型
{
  private:
    T *element;                                  //动态数组存储顺序表的数据元素
    int size;                                    //顺序表的数组容量
    int len;                                     //顺序表长度

  public:
    SeqList(int size=64);                        //构造指定(默认)容量的空表
    SeqList(T value[] int n);                   //构造由指定数组提供元素的顺序表
    ~SeqList();                                  //析构函数 

    bool isEmpty();                              //判断顺序表是否为空
    int length();                                //返回顺序表长度    
    T get(int i);                                //返回第i(i≥0)个元素
    bool set(int i T x);                        //设置第i个元素为x
    void insert(int i T x);                     //插入x作为第i个元素
    void insert(T x);                            //在顺序表最后插入x
    bool remove(int i T& old);                  //删除第i个元素,原值存放在old变量中 
    void clear();                                //清空顺序表
    friend ostream& operator<<(ostream& out SeqList &list);    //输出顺序表所有元素

    //8.2.1 顺序查找
    int index(T value);                          //顺序查找指定元素
    bool contain(T value);                       //判断线性表是否包含指定元素


};

template 
SeqList::SeqList(int size)                    //构造指定容量的空表
{
    this->size = size<64 ? 64 : size;
    this->element = new T[this->size];
    this->len = 0;
}

template 
SeqList::SeqList(T value[] int n)            //构造由value数组提供元素的顺序表
{                                                //n指定数组元素个数
    if (n>0) 
    {
        this->element = new T[2*n];
        this->size = 2*n;
        for (int i=0; i            this->element[i] = value[i];
        this->len = n;
    }
}

template 
SeqList::~SeqList()                           //析构函数
{
    delete []this->element;
}

template 
bool SeqList::isEmpty()                       //判断顺序表是否为空
{
    return len==0;
}

template 
int SeqList::length()                         //返回顺序表长度
{
    return len;
}

template 
T SeqList::get(int i)                         //返回第i(i≥0)个元素
{                                                //若i指定元素序号无效则抛出异常
    if (i>=0 && i        return element[i];
    throw “参数i指定元素序号无效“;
}

template 
bool SeqList::set(int i T x)                 //设置第i个元素为x
{                                                //操作成功返回true,若i指定序号无效返回false
    if (i>=0 && i    {
        element[i] = x;
        return true;
    }
    return false;
}

template 
ostream& operator<<(ostream& out SeqList &list)   //输出顺序表所有元素
{
    out<<“(“;
    if (list.len>0)
    {
        out<        for (int i=1; i             out<<“ “<    }
    out<<“)\n“;
    return out;
}

template 
void SeqList::insert(int i T x)            

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        217  2011-12-27 19:37  图书管理系统(数据结构版)\BOOK.H

     文件          4  2012-06-01 18:36  图书管理系统(数据结构版)\Debug\library.txt

     文件          4  2012-06-01 18:36  图书管理系统(数据结构版)\Debug\student.txt

     文件     435200  2012-12-03 20:49  图书管理系统(数据结构版)\Debug\vc60.idb

     文件      86016  2012-12-03 20:49  图书管理系统(数据结构版)\Debug\vc60.pdb

     文件    1967104  2012-12-03 19:14  图书管理系统(数据结构版)\Debug\图书管理系统.bsc

     文件     274515  2012-12-03 20:49  图书管理系统(数据结构版)\Debug\图书管理系统.exe

     文件     356712  2012-12-03 20:49  图书管理系统(数据结构版)\Debug\图书管理系统.ilk

     文件      83563  2012-12-03 20:49  图书管理系统(数据结构版)\Debug\图书管理系统.obj

     文件    3631256  2012-12-03 20:45  图书管理系统(数据结构版)\Debug\图书管理系统.pch

     文件     672768  2012-12-03 20:49  图书管理系统(数据结构版)\Debug\图书管理系统.pdb

     文件          0  2012-12-03 19:14  图书管理系统(数据结构版)\Debug\图书管理系统.sbr

     文件        146  2012-01-03 19:55  图书管理系统(数据结构版)\Library.h

     文件        824  2012-12-03 20:44  图书管理系统(数据结构版)\library.txt

     文件       8705  2011-12-24 15:14  图书管理系统(数据结构版)\SeqList.cpp

     文件        618  2012-01-03 19:39  图书管理系统(数据结构版)\student.h

     文件       1552  2012-01-03 22:16  图书管理系统(数据结构版)\student.txt

     文件        217  2011-12-27 19:37  图书管理系统(数据结构版)\图书管理系统\BOOK.H

     文件     140288  2012-03-21 21:51  图书管理系统(数据结构版)\图书管理系统\Debug\vc60.idb

     文件      77824  2012-03-21 21:50  图书管理系统(数据结构版)\图书管理系统\Debug\vc60.pdb

     文件     258144  2012-03-21 21:50  图书管理系统(数据结构版)\图书管理系统\Debug\图书管理系统.ilk

     文件      80853  2012-03-21 21:50  图书管理系统(数据结构版)\图书管理系统\Debug\图书管理系统.obj

     文件    3663932  2012-03-21 21:50  图书管理系统(数据结构版)\图书管理系统\Debug\图书管理系统.pch

     文件     476160  2012-03-21 21:50  图书管理系统(数据结构版)\图书管理系统\Debug\图书管理系统.pdb

     文件        146  2012-01-03 19:55  图书管理系统(数据结构版)\图书管理系统\Library.h

     文件        168  2012-03-21 21:52  图书管理系统(数据结构版)\图书管理系统\library.txt

     文件        618  2012-01-03 19:39  图书管理系统(数据结构版)\图书管理系统\student.h

     文件          4  2012-03-21 21:50  图书管理系统(数据结构版)\图书管理系统\student.txt

     文件      28300  2012-01-03 22:15  图书管理系统(数据结构版)\图书管理系统\图书管理系统.cpp

     文件      28276  2012-12-03 20:49  图书管理系统(数据结构版)\图书管理系统.cpp

............此处省略12个文件信息

评论

共有 条评论