#include#include using namespace std; int main() { deque d = {1, 2, 3, 4, 5}; cout << "Element at index 2: " << d.at(2) << endl; d.at(2) = 6; cout << "Updated element at index 2: " << d.at(2) << endl; return 0; }
Element at index 2: 3 Updated element at index 2: 6In this example, we create a deque of integers and access an element using `at`. We then update the element and display the new value using `at`. Package Library: The `std::deque` is part of the C++ Standard Template Library (STL), which is included in the standard C++ library. Thus, no external package library is required to use it.