Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. Requirements:
  2. 1) The program must use STL list and string classes;
  3. 2) The program must implement Search function
  4. 3) The Search function has to be a template
  5. 4) The function must declare three parameters: aList to search in, starting iterator position, and the value to search for
  6. 5) The function must return iterator position of the search value in the list
  7. 6) The function must throw an exception if the value is not found in the list
  8. 7) The exception must be caught and reported in the main
  9. 8) The function must search the list recursively
  10.  
  11. Tips:
  12. 1) When outputting iterator value pos use distance(myList.begin(), pos) function to obtain the ‘index’ of the element in the list (defined in <list> header).
  13. 2) Use typename list<T>::iterator to declare iterator as a parameter or return type in template function.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement