#include#include int main() { std::vector vec = {1, 2, 3, 4, 5}; // Iterate over the vector using range begin and end for (auto it = std::begin(vec); it != std::end(vec); ++it) { std::cout << *it << ' '; } return 0; }
#includeThis code creates a string and then uses range begin to print out the first character in the string. Package: Standard Library (C++11)#include int main() { std::string str = "hello"; // Print out the first character in the string using range begin std::cout << *std::begin(str); return 0; }