#include <iostream>
#include <vector>
int main() {
std::vector<int> nums = {1,2,3};
std::cout << "the numbers:" << std::endl;
for(int i=0; i<nums.size(); i++)
std::cout << i << " : " << nums[i] << std::endl;
std::cout << "the numbers with an extra iteration:" << std::endl;
for(int i=-1; i<nums.size(); i++)
std::cout << i << " : " << nums[(i>=0)?i:0] << std::endl;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: