List Element Access and Iterator

include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); list l = {10, 20, 40, 40, 40, 40, 40, 100, 30, 10000, 20000, 10000}; cout

Jan 31, 2025 - 11:42
 0
List Element Access and Iterator

include

using namespace std;

int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
list l = {10, 20, 40, 40, 40, 40, 40, 100, 30, 10000, 20000, 10000};
cout << l.back() << endl;
cout << l.front() << endl;
cout << *next(l.begin() , 2) << endl ;
cout << *l.begin() << endl ;
cout << l.front() << endl ;
return 0;
}