A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://TheAlgorithms.github.io/C-Plus-Plus/d9/d02/linear__search_8cpp_source.html below:

TheAlgorithms/C++: search/linear_search.cpp Source File

Go to the documentation of this file. 22 for

(

int

i = 0; i < size; ++i) {

23 if

(array[i] == key) {

39 int

*array =

new int

[size];

40 for

(

int

i = 0; i < size; i++) {

51

array =

new int

[size];

52 for

(

int

i = 0; i < size; i++) {

60

std::cout <<

"All tests have successfully passed!\n"

;

71

std::cout <<

"Choose mode\n"

;

72

std::cout <<

"Self-test mode (1), interactive mode (2): "

;

78

std::cout <<

"\nEnter the size of the array [in range 1-30 ]: "

;

81 while

(size <= 0 || size > 30) {

82

std::cout <<

"Size can only be 1-30. Please choose another value: "

;

86 int

*array =

new int

[size];

90

std::cout <<

"Enter the array of "

<< size <<

" numbers: "

;

91 for

(

int

i = 0; i < size; i++) {

95

std::cout <<

"\nEnter the number to be searched: "

;

100

std::cout <<

"Number found at index: "

<< index <<

"\n"

;

102

std::cout <<

"Array element not found"

;

static void tests()

Self-test implementations.

int LinearSearch(int *array, int size, int key)

for IO operations

int main()

Main function.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4