#include#include using namespace std; int main() { vector v = {5, 10, 15, 20}; cout << "The first element of vector v is " << v.front() << endl; return 0; }
The first element of vector v is 5
#include#include using namespace std; int main() { vector v = {"hello", "world", "how", "are", "you"}; string& first = v.front(); first = "hey"; cout << "The first element of vector v is now " << v.front() << endl; return 0; }
The first element of vector v is now heyThese examples use the std package library, which is part of the C++ standard library.