#include <stdio.h>
#define MAXSIZE 10
typedef int ElemType;
typedef struct
{
ElemType elem[MAXSIZE];
int last;
}SeqList;
int Locate(SeqList L,ElemType e)
{int i=0;
while((i<=L.last)&&(L.elem[i]!=e))
{
i++;
}
if(i<=L.last)
return(i+1);
else
return(-1);
}
void main()
{
int i,m;
printf("请输入五个数字");
ElemType e=8;
SeqList *L;
L->last=-1;
for(i=0;i<=4;i++)
{
scanf("%d",&L->elem[i]);
L->last++;
}
m=Locate(*L,e);
printf("%d",m);
if (m==-1)
printf("can't found!");
else
printf("congratulations!");
}
#define MAXSIZE 10
typedef int ElemType;
typedef struct
{
ElemType elem[MAXSIZE];
int last;
}SeqList;
int Locate(SeqList L,ElemType e)
{int i=0;
while((i<=L.last)&&(L.elem[i]!=e))
{
i++;
}
if(i<=L.last)
return(i+1);
else
return(-1);
}
void main()
{
int i,m;
printf("请输入五个数字");
ElemType e=8;
SeqList *L;
L->last=-1;
for(i=0;i<=4;i++)
{
scanf("%d",&L->elem[i]);
L->last++;
}
m=Locate(*L,e);
printf("%d",m);
if (m==-1)
printf("can't found!");
else
printf("congratulations!");
}