#include <iostream>
using namespace std;

const int LIMIT = 200;

int linearSearch(int[], int, int);
int inputArraySize(int);
void inputArray(int[], int);

int main() {

	int size = inputArraySize(LIMIT);
	int array[LIMIT];
	inputArray(array, size);

	int element;
	cout << "Input a number: ";
	cin >> element;

	int index = linearSearch(array, size, element);
	if(index > -1) {
		cout << "array[" << index << "] = " << array[index] << endl;
	} else {
		cout << "The element is not in the array." << endl;
	}

	return 0;	
}

int inputArraySize(int limit) {
	
	int size;
	do {
		cout << "Input number of elements [1, " << limit << "]: ";
		cin >> size;
	} while(size < 1 || size > limit);
	return size;
}

void inputArray(int array[], int size) {

	cout << "Input all the " << size << " elements:" << endl;
	for(int i = 0; i < size; ++i) {
		cin >> array[i];
	}

}

int linearSearch(int array[], int size, int element) {

	for(int i = 0; i < size; ++i) {
		if(array[i] == element) {
			return i;
		}
	}
	return -1;
}
