#include#include using namespace std; int main(){ list
nums {10,20,30,40,50}; list ::iterator it; for(it = nums.begin(); it != nums.cend(); it++){ cout << *it << " "; } return 0; }
#includeThis example uses c2rend to loop through the reverse order of the elements in the list and print them to the console. The package library for cpp std list cend is the Standard Template Library (STL).#include #include
using namespace std; int main(){ list names {"Alice", "Bob", "Charlie", "Dave"}; list ::reverse_iterator r_it; for(r_it = names.rbegin(); r_it != names.crend(); r_it++){ cout << *r_it << " "; } return 0; }