vector::at() || Finding element with given position using vector in C++

#include <iostream>
#include <vector>

int main() {
    // Declare and initialize a vector
    std::vector<int> myVector = {10, 20, 30, 40, 50};

    // Use vector::at() to access element at a given position
    int position = 2;
    int elementAtPosition = myVector.at(position);

    // Display the result
    std::cout << "Element at position " << position << ": " << elementAtPosition << std::endl;

    return 0;
}