c 2b 2b how to skip the last element of vector

Solutions on MaxInterview for c 2b 2b how to skip the last element of vector by the best coders in the world

showing results for - "c 2b 2b how to skip the last element of vector"
Louane
30 Oct 2018
1std::vector<int> x{1,2,3,4,5,6};
2
3for (auto iter = x.begin(); iter != std::prev(x.end()); ++iter){
4  std::cout << *iter << std::endl;
5}
similar questions