go to particular place in vector using iterator

#include <iostream>
#include <vector>

int main() {
    std::vector<int> vec = {1, 2, 3, 4, 5};

    // Initializing an iterator to the beginning of the vector
    std::vector<int>::iterator it = vec.begin();

    // Advancing the iterator by a specific number of positions
    std::advance(it, 2);

    // Checking if the iterator is not pointing beyond the end of the vector
    if (it != vec.end()) {
        // Accessing the value at the position pointed by the iterator
        int value = *it;
        std::cout << "Value at position 2: " << value << std::endl;
    } else {
        std::cout << "Iterator out of range" << std::endl;
    }

    return 0;
}