#include#include using namespace std; int main() { vector myVector { 10, 20, 30, 40, 50 }; int firstElement = myVector.get(0); cout << "The first element is: " << firstElement << endl; return 0; }
The first element is: 10
#include#include using namespace std; int main() { vector myVector { "apple", "banana", "orange", "grape" }; string lastElement = myVector.get(myVector.size() - 1); cout << "The last element is: " << lastElement << endl; return 0; }
The last element is: grapePackage Library: The vector class is part of the standard template library (STL) in C++, which is included in the