#include<iostream.h>
#define max 100
#define ok 1 typedef int type;
typedef struct {type elem[max];
int length;
}stable; void creatlist(stable L,int n)
{int i;
cout<<"Please input the number of list:";
for(i=0;i<n;i++)
cin>>L->elem[i];
L->length=n;
} void showlist(stable L)
{int i;
for(i=1;i<L.length ;i++)//按序号输出查找的序列
{cout<<i<<"--"<<L.elem[i];
cout<<endl;}
}
//search_1()补充顺序查找算法
main()
{int m,x;
stable T ;
type key;
cout<<"please input the M:";
cin>>m;
cout<<"\n";//调用上面的建表函数完成建立顺序表
cou<<"\n";
showlist(T);
cout<<"I want to find the:";
cin>>key;
cout<<"\n";
//x=search_1(T,key),//顺序查找并输出key的位置,注意参数的变化。
cout<<"The key find,search position is:"<<x<<"\n";
}
#define max 100
#define ok 1 typedef int type;
typedef struct {type elem[max];
int length;
}stable; void creatlist(stable L,int n)
{int i;
cout<<"Please input the number of list:";
for(i=0;i<n;i++)
cin>>L->elem[i];
L->length=n;
} void showlist(stable L)
{int i;
for(i=1;i<L.length ;i++)//按序号输出查找的序列
{cout<<i<<"--"<<L.elem[i];
cout<<endl;}
}
//search_1()补充顺序查找算法
main()
{int m,x;
stable T ;
type key;
cout<<"please input the M:";
cin>>m;
cout<<"\n";//调用上面的建表函数完成建立顺序表
cou<<"\n";
showlist(T);
cout<<"I want to find the:";
cin>>key;
cout<<"\n";
//x=search_1(T,key),//顺序查找并输出key的位置,注意参数的变化。
cout<<"The key find,search position is:"<<x<<"\n";
}