#include<iosteam.h> using namespace std; main() { int a[10],i,temp; for(i =0; i<10; i++) cin>>a[i]; cin>>temp; for( i =0; i<10; i++) //10为数组长度 if(a[i] == temp) //temp为要查找的元素 break; cout<<"该元素在数组中的位置为i:="<<i<<endl; }
数组值定下标
最新推荐文章于 2023-05-18 04:23:41 发布