Advertisement

用C++实现顺序表的基本操作

阅读量:

线性表概念代码实现

复制代码
    #include<stdio.h>
    #include<iostream>
    
    using namespace std;
    
    //函数结果状态代码
    #define TRUE   1
    #define FALSE  0
    #define OK     1
    #define ERROR  0
    #define INFEASIBLE -1
    #define OVERFLOW   -2
    //Status 是函数的类型,其值是函数结果状态代码
    
    typedef int Status;    // Status 相当于 int 
    typedef char ElemType; //Elemtype 相当于 char 
    
    #define  MAXSIZE  100       //线性表存储空间的初始分配量
    typedef  struct
    {
      ElemType *elem;           //存储空间的基地址
      int length;               //当前长度
    }SqList;                    //顺序表类型名称为Sqlist 
    

全部评论 (0)

还没有任何评论哟~