#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
srand(time(0));
const int N = 25;
int arr[N];
bool taken[N] = {0};
int checked = 0;
cout << "ALL ARRRAY: ";
for (int i = 0; i < N; i++) {
arr[i] = rand() % 50 + 1;
cout << arr[i] << " ";
}
cout << "\n";
int M;
cout << "ENTER M SERCHED: ";
cin >> M;
while (checked < N) {
int index = rand() % N;
if (taken[index]) {
continue;
}
taken[index] = true;
checked++;
cout << "CHECKING " << index
<< " STOJNONST " << arr[index] << "...\n";
if (arr[index] == M) {
cout << "=== FOUND! ===\n";
cout << "M = " << M << " IS AT INDEX " << index << "\n";
return 0;
}
}
cout << "=== NOT FOUND ===\n";
cout << "ALL ARE CHECKED " << N << " ELEMNTS.\n";
system("pause");
return 0;
}