C++ program to perform linear search
/* Write a program to implement linear search */
#include
using namespace std;
int main() {
cout << "Enter size of array: ";
int size; cin >> size;
const int s = size;
int a[s];
cout << "Enter values for array..." << endl;
for (int i=0; i> a[i];
}
cout << endl;
cout << "Enter value to search: ";
int n; cin >> n;
bool found = false;
cout << endl;
cout << "Value found at: ";
for (int i=0; i
No comments:
Post a Comment