#include
#include
#define LIST_INIT_SIZE 100
#define LIST_INCREMENT 10
using namespace std;
struct Sqlist{
long *elem, *newlist;
int Length;
int listsize;
};
void Error(char *s)
{
cout << s << endl;
exit(1);
}
void InitList_Sq(Sqlist &L) //创建含有若干个数据元素的顺序表
{
L.elem = new long[LIST_INIT_SIZE];
if (!L.elem)
Error("Overflow!");
L.Length = 0;
L.listsize = LIST_INIT_SIZE;
}
void Create_Sq(Sqlist *L)
{
int i, num;
cout << "请输入顺序表元素个数:";
cin >> num;
cout << "请输入数据元素:";
for (i = 0; i
{
cin >> L->elem[i];
L->Length++;
}
cout <