linear search in cpp