问题描述:实现顺序表的基本运算(1-12具体要求见课本P62),作为对已经学过的顺序表的小revision~
源代码:
list.h:
#include <stdio.h>#include <malloc.h>#define max 100typedef char Elemtype;typedef struct list{
char data[max]; int length;} Sqlist;void Initlist(Sqlist *&l);void Createlist(Sqlist *&l,Elemtype a[],int n);void Displist(Sqlist *l);int Listlength(Sqlist *l);bool Listempty(Sqlist *l);void Dispelement(Sqlist *l,int loc);void Disploc(Sqlist *l,Elemtype e);bool Insertelement(Sqlist *&l,int loc,Elemtype e);bool Deleteelement(Sqlist *&l,int loc,Elemtype &e);void Destroylist(Sqlist *&l);
fun.cpp:
#include <stdio.h>