finding the last element of a vector code example
Example 1: cpp get last element of vector
vector<int> vec;
vec.push_back(0);
vec.push_back(1);
int last_element = vec.back();
int also_last_element = vec[vec.size() - 1];
Example 2: c++ get last element in vector
std::v.back()