#include<stdio.h>
#define KeyType int
typedef struct SeqList{
int key;
}SeqList;
int SeqSearch(SeqList R[],int n,KeyType k)
{
int i=0;
while(i<n&&R[i].key!=k)
{
printf("%d ",R[i].key);
i++;
}
if(i>=n)
return -1;
else
{
printf("%d",R[i].key);
return i;
}
}
int main()
{
int result,line[]={9,13,15,7,45,32,56,89,60,36};
SeqList box[10];
for(int i=0;i<10;i++)
{
box[i].key=line[i];
}
printf("请输入你要查找的整数");
int k;
scanf("%d",&k);
result=SeqSearch(box,10,k);
if(result!=-1)
{
printf("查找成功,位置是:%d",result);
}
else
{
printf("元素未在列表里面");
}
}