Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
#include
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; }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)