Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Linear search
#include <iostream> using namespace std; int main() { int arr[5]={2,4,1,3,6}; int num; int flag=0; cout<<"enter the number you wish to search"; cin>>num; for( int i=0; i<5; i++) { if(arr[i] == num) { cout<<num<<"is available at position"<<i; flag=1; } break; } if(flag==0) cout<<"not found"; }
run
|
edit
|
history
|
help
1
Recursive Enumeration Example
insertion sort
CS1428 SI Tuesday
Template arguments may contain calls to constexpr functions.
__FUNCTION__ not a preprocessor macro on clang
Throttle Example using circular queue (push all but 2 less than maxSize; then pop all but 2 less than current size)
cv5_class
C++ Standard Template Library
Exploring stringstreams
numeric_limits