#include<stdio.h>
#include<stdlib.h>
#define MAXSIZE 100
#define ERROR 0
#define OK 1
typedef int ElemType;
typedef int status;
typedef struct {
ElemType *elem;
int length;
} SqList;
status InitList(SqList &L){
L.elem = new int[MAXSIZE];
if(!L.elem)
exit(ERROR);
L.length = 0;
return OK;
}
status Create(SqList L) {
int i,n;
printf("输入元素个数:");
scanf("%d",&n);
L.length=n;
printf("输入整型元素: ");
for (i=0; i<n; i++)
scanf("%d", &L.elem[i]);
return OK;
}
void ListOutput(SqList L) //输出List
{
int i;
for (i = 0; i < L.length; i++)
printf("%d",L.elem[i]) ;
return;
}
int main() {
SqList L;
InitList(L);
Create(L);
ListOutput(L);
return 0;
}