跪求用C++编程!

来源:百度知道 编辑:UC知道 时间:2024/05/31 03:50:34
线性表中的查找,插入,删除!
谢谢!

#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
#define max 100
typedef int ElemType;
typedef int Status;
typedef struct{
ElemType elem[max];
int length;
}SqList;
Status InitList(SqList &L)//构造一个空的固定内存空间顺序线性表L,约定元素从1开始
{
if(!L.elem)exit(OVERFLOW);
L.length=0;
return OK;
}//InitList

Status Input(SqList &L)//键盘输入存入线性表L
{
int i;
for(i=1;i<=10;i++)
cin>>L.elem[i];
L.length=10;
return OK;
}//Input

Status Autoput(SqList &L)//随机(0~100)赋值存入线性表L
{
int i;
srand((unsigned int) time(NULL));
for(i=1;i<=10;i++)
L.elem[i]=rand()%100;
L.length=10;
return OK;
}//Autoput

bool PK(SqList &L)//判空判满
{
if