#include
int search(int list[],int n,int x)
{
int i;
for(i=0;i
return -1;
}
main()
{
int list[10],n,x,i;
printf("input n(1<=n<=10):");
scanf("%d",&n);
printf("input %d numbes:\n",n);
for(i=0;i
printf("input x:");
scanf("%d",&x);
if(search(list,n,x)==-1)printf("N0 Found\n");
else printf("the NO.%d\n",search(list,n,x));
}
#include
using namespace std;
int search(int list[],int n,int x)
{
for(int i=0;i
if(list[i]==x)
{
return i;
break;
}
}
return -1;
}
main()
{
int list[10],n,x,i;
cout<<"Pleaese input n(1<=n<=10):";
cin>>n;
cout<<"\nPleaese input "<
cout<<"\nPleaese input x:";
cin>>x;
if(search(list,n,x)==-1) cout<<"\nN0 Found\n";
else cout<<"\n该数的下标为:"<
#include
int search(int list[],int n,int x)
{
int i;
for(i=0;i
return -1;
}
main()
{
int list[10],n,x,i;
printf("input n(1<=n<=10):");
scanf("%d",&n);
printf("input %d numbes:\n",n);
for(i=0;i
printf("input x:");
scanf("%d",&x);
if(search(list,n,x)==-1)printf("N0 Found\n");
else printf("the NO.%d\n",search(list,n,x));
}