编写应用程序,实现可以在顺序表中插入任意给定数据类型数据的功能(定义为ElemType抽象数据类型)。要求在主函数中定义顺序表并对该顺序表插入若干个整数类型的数据(正整数),对它们求和并输出。
SqList.h
#include<iostream>
using namespace std;
typedef int ElemType;
#define MAXSize 50
#define OVERFLOW -2
typedef struct List {
ElemType* elem;
int length;
}SqList;
void InitList(SqList& L)
{
//构造一个空的顺序表
L.elem = new ElemType[MAXSize];
if (!L.elem) exit(OVERFLOW);
L.length =

568

被折叠的 条评论
为什么被折叠?



