1 / 17
文档名称:

线性表顺序存储结构.ppt

格式:ppt   大小:172KB   页数:17页
下载后只包含 1 个 PPT 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

线性表顺序存储结构.ppt

上传人:xxj16588 2018/5/12 文件大小:172 KB

下载得到文件列表

线性表顺序存储结构.ppt

文档介绍

文档介绍:实验一参考源程序
#include<>
#include<>
#include<>
#define ERROR 0
#define OK 1
#define EQUAL 1
#define OVERFLOW -1
#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10
实验一参考源程序
struct STU{
char name[20];
char stuno[10];
int age;
int score;
} stu[50];
typedef struct STU ElemType;
struct LIST
{
ElemType *elem;
int length;
int listsize;
};
typedef struct LIST List;
int init(List *L);
int ListLength(List L);
void GetElem(List L,int i,ElemType *e);
int EqualList(ElemType e1,ElemType e2);
int Less_EqualList(ElemType e1,ElemType e2);
int LocateElem(List La,ElemType e,int type);
int ListInsert(List *L,int i, ElemType e);
void MergeList(List La,List Lb,List *Lc);
void UnionList(List *La, List Lb);
int printlist(List L);
实验一参考源程序
main()
{
ElemType e;
List La,Lb,Lc;
clrscr();
printf("\n\n-------------------List Demo is running----------------\n\n");
printf("First is InsertList function.\n");
init(&La);
实验一参考源程序
strcpy(,"stu1");
strcpy(,"100001");
=80;
=1000;
ListInsert(&La,1,e);
strcpy(,"stu3");
strcpy(,"100002");
=80;
=1000;
ListInsert(&La,2,e);
printlist(La);
printf("List A length now is %d.\n\n",);
getch();
实验一参考源程序
strcpy(,"stu5");
strcpy(,"100003");
=80;
=1000;
ListInsert(&La,3,e);
printlist(La);
printf("List A length now is %d.\n\n",);
getch();
实验一参考源程序
init(&Lb);
strcpy(,"stu2");
strcpy(,"100001");
=80;
=1000;
ListInsert(&Lb,1,e);
strcpy(,"stu4");
strcpy(,"100002");
=80;
=1000;
ListInsert(&Lb,2,e);
实验一参考源程序
strcpy(,"stu6");
strcpy(,"100001");
=80;
=1000;
ListInsert(&Lb,3,e);
printlist(Lb);
printf("List B length now is %d.\n\n",);
getch();
实验一参考源程序
MergeList(La,Lb,&Lc);
printlist(Lc);
getch();
printf("Second is UnionList function.\n");
printf("Now union List A and List B.....\n");
UnionList(&La,Lb);
prin