// FILE: LinSrDrv.cpp // DRIVER FOR FUNCTION "lin_search" #include #define SIZE 5 #include "LnSearch.cpp" // Functions Used... // SEARCHES AN INTEGER ARRAY FOR A GIVEN ELEMENT (THE TARGET) int lin_search (const apvector &, // IN: the array being searched int); // IN: the target being sought // driver (not included in the text) int main () { // Local Data... apvector items(SIZE); int target; int target_index; // read in the array of items cout << endl << "Enter " << SIZE << " number of integers seperated by a space for array 1 > " << endl; for (int i = 0; i < items.length(); i++) cin >> items[i]; // read in the integer to be searched for cout << "Enter the integer to be searched for > "; cin >> target; // find the target integer in the array of items target_index = lin_search (items, target); // print results if (target_index != -1) cout << endl << "The target integer was found at index " << target_index << "." << endl; else cout << endl << "The target integer was not found." << endl; return 0; }