#includeusing namespace std;
#define maxsize 1000
#define error -1
typedef struct
sqlist;
void initlist(sqlist &l)//初始化順序表
}void printlist(sqlist l)
int locateelement(sqlist l,int e)//按元素位置查詢
l.data[i-1]=e;
l.length++;
return 1;
}void deleteall(sqlist &l,int ele)//刪除所有值為ele的元素
while (i>list.length;
initlist(list);
printlist(list);
// // move(list);
/* printlist(list);*/
deletesame(list);
printlist(list);
int e;
cout<<"輸入要查詢的位置:";
int location;
cin>>location;
getelement(list,location,e);
cout<<"第"<>place;
cout<<"輸入要插入的值:";
cin>>ele;
insertelement(list,place,ele);
printlist(list);
int element;
cout<<"輸入要查詢的值:";
cin>>element;
cout<>a;
deleteall(list,a);
printlist(list);
return 0;
}
線性表順序儲存相關操作
線性表的順序儲存結構,指的是用一段位址連續的儲存單元依次儲存線性表的資料元素。下面給出關於線性表順序儲存常用操作的 include define maxsize 20 儲存空間初始分配量 define true 1 define false 0 typedef int elemtype typede...
線性表(順序儲存)的相關操作
include include define list init size 100 定義線性表空間的初始儲存大小為 define true 1 define false 0 define ok 1 define error 0 typedef int status typedef int elemt...
筆記四 線性表 陣列描述
pragma warning disable 4996 include include include using namespace std typedef struct mytype template class linearlist 析構函式 virtual bool empty const ...