#include
#define List_init_size 100 //符號常量的定義
#define Listincrement 100
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
typedef int Elemtype;//抽象資料型別elemtype具體化為int型別
typedef int Status;
typedef struct { //定義結構體
Elemtype *elem;
int length;
int listsize;
}Sqlist;
Status Initlist_sq(Sqlist *l) //函式(初始化順序表)初始化失敗則返回-2
{
l->elem =(Elemtype*)malloc(sizeof(Elemtype));
if(!l->elem ) return(OVERFLOW);
l->length =0;
l->listsize =List_init_size;
return OK;
}
Status Creatlist_sq(Sqlist *l,int n) //初始化順序表為含有n個元素的順序表
int i;
printf("Input %d numbers:\n",n);
for(i=0;i
#include
#include
#define List_init_size 100 //符號常量的定義
#define Listincrement 100
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
typedef int Elemtype;//抽象資料型別elemtype具體化為int型別
typedef int Status;
typedef struct { //定義結構體
Elemtype *elem;
int length;
int listsize;
}Sqlist;
Status Initlist_sq(Sqlist *l) //函式(初始化順序表)初始化失敗則返回-2
{
l->elem =(Elemtype*)malloc(sizeof(Elemtype));
if(!l->elem ) return(OVERFLOW);
l->length =0;
l->listsize =List_init_size;
return OK;
}
Status Creatlist_sq(Sqlist *l,int n) //初始化順序表為含有n個元素的順序表
{
int i;
printf("Input %d numbers:\n",n);
for(i=0;i