How to Access the Last Element in a Vector in C++?
Given a vector of n elements, the task is to access the last element in C++.ExamplesInput: v = {11, 23, 9, 7};Output: 7Explanation: Since 7 is the last element of the vector.Input: v = {1, 3, 11, 52};Output: 52Explanation: Since 52 is the last element of the vector.Following are the different ways f