Group 3 Exercises

Programming Exercises. These exercises are used to apply the concepts learned in this session. Please do attempt them in small groups if possible. 

You are invited to ask questions during the seminar time.

Exercise 1:

Write a function template palindrome that takes a vector parameter and returns true or false according to whether the vector does or does not read the same forward as backward (e.g., a vector containing 1, 2, 3, 2, 1 is a palindrome, but a vector containing 1, 2, 3, 4 is not).

Exercise 2:

Load sequenced.cpp and implement the following:

  • overload print()
  • access with front() and back()
  • push_front() and push_back

最后修改: 2018年12月18日 Tuesday 07:35