有关数据结构的问题~~C++

来源:百度知道 编辑:UC知道 时间:2024/05/21 11:39:48
#include "stdafx.h"
#include "iostream.h"
#include "stdlib.h"
typedef int ElemType;
struct List{
ElemType *list;
int size;
int MaxSize;
};
void main()
{
int a[12]={3,6,9,12,15,18,21,24,27,30,33,36};
int i;
ElemType x;
List t;
InitList(t);
for(i=0;i<12;i++)InsertList(t,a[i],i+1);
InsertList(t,48,13);InsertList(t,40,0);
cout<<GetList(t,4)<<' '<<GetList(t,9)<<endl;
TraverseList(t);
cout<<"输入待查找的元素值:";
cin>>x;
if(FindList(t,x)) cout<<"查找成功!"<<endl;
else cout<<"查找失败!"<<endl;
cout<<"输入待删除元素的值:";
cin>>x;
if(DeleteList(t,x,0)) cout<<"删除成功!"<<endl;
else cout<<"删除失败!"<<endl;
for(i=0;i<6;i++)
DeletleList(t,x,i+1);
TraverseList(t)

InitList、InsertList、GetList、TraverseList、FindList、DeleteList、LenthList、EmptyLis、ClearList这些函数没定义,你自己在书上找一下这些函数的定义,抄到这个程序里就行了!
他前面一定有写,一般书都这样!

EmptyList
ClearList
LenthList
DeletleList
DeleteList
FindList
TraverseList
GetList
InsertList
InitList

上面的函数定义都不存在!