#include<iostream.h>
int main()
{
int a[15]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
cout<<"Please input the number :"<<endl;
int iNum;
cin>>iNum;
for(int i=0;i<15;i++)
{
if(a[i]==iNum)
{
cout<<"The location is :"<<i+1<<endl;
break;
}
}
if(i==15)
{
cout<<"It's not in the array"<<endl;
}
return 0;
}
顺序查找
最新推荐文章于 2022-02-12 15:02:30 发布