// Read an array, a number and search the array for the number. // Michael Rothstein // (date) #include using std::cin; using std::cout; using std::endl; const int MAXSIZE=100; int search(int array[],int n,int look4); // Returns the index wher it finds the number or -1 if not found. int main(){ int data[MAXSIZE],i,lookfor,found; cout << "Input the numbers in the array, ending with -1:\n"; for(i=0;i> data[i]; if(data[i] == -1) break; } cout << "What number do we want to look for?: "; cin >> lookfor; found = search(data,i,lookfor); if ( found >= 0 ) { cout << lookfor << " found at position " << found+1 << endl; } else { cout << lookfor << " was not in the data.\n"; } return 0; } int search(int array[],int n,int x){ int i; for(i=0;i