这里为什么写k==10就可以了#include
using namespace std;
int main()
{ int k, x;
int array[ ] = { 2, 3, 1, 7, 5, 8, 9, 0, 4, 6};
cout << "请输入要查找的元素值:";
cin >> x;
for (k = 0; k < 10; ++k)
if (x == array[k])
{ cout << "Find k, at position " << k; break;}
if (k == 10) cout << "not found";
return 0;
}