问题及代码
/*
*Copyright (c) 2015,烟台大学计算机学院
*All rights reserved.
*文件名称:test.cpp
*作者:王敏
*完成日期:2015年09月16日
*版本号:v1.0
*
*问题描述:ListInsert、ListDelete、InitList、DestroyList函数
*输入描述:
程序输出:
*/
#include <stdio.h>
#include <malloc.h>
#define MaxSize 50
typedef int ElemType;
typedef struct
{
ElemType data[MaxSize];
int length;
} SqList;
void CreateList(SqList *&L, ElemType a[], int n);//用数组创建线性表
void DispList(SqList *L);//输出线性表DispList(L)
bool ListEmpty(SqList *L);//判定是否为空表ListEmpty(L)
int ListLength(SqList *L); //求线性表的长度ListLength(L)
bool GetElem(SqList *L,int i,ElemType &e); //求某个数据元素值GetElem(L,i,e)
int LocateElem(SqList *L, ElemType e); //按元素值查找LocateElem(L,e)
void InitList(SqList *&L);//初始化线性表InitList(L)
bool ListInsert(SqList *&L,int i,ElemType e);//插入数据元素ListInsert(L,i,e)
bool ListDe