C++ Linear Search for Data Structures