Playground
#include <iostream> #include <list> using namespace std; int main() { list<int> l; //l={} l.push_back(4); //l={4} l.push_front(1); //l={1, 4} l.push_back(5); //l={1, 4, 5} l.push_back(6); //l={1, 4, 5, 6} l.push_back(6); //l={1, 4, 5, 6, 6} l.pop_front(); //l={4, 5, 6, 6} l.pop_back(); //l={4, 5, 6} l.insert(l.begin(), 3); //l={3, 4, 5, 6} l.insert(l.begin(), 2, 1); //l={1, 1, 3, 4, 5, 6} cout << l.size() << endl; //pechati '6' return 0; }
Input data
Program output
no input
Execute
Language: ????????? | Memory: ???? KB | Time: ??? ms
Nothing has been executed, yet!