File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ void display(list <int> &lst1){
1010 for (it = lst1.begin (); it != lst1.end (); it++){
1111 cout << *it << endl;
1212 }
13+ cout << endl;
1314}
1415int main (){
1516 list<int > list1; // List of 0 length
@@ -39,16 +40,23 @@ int main(){
3940 // ! Way 3rd to print the list
4041 display (list1);
4142
42- list<float > list2 (3 ); // Empty list of size 3
43- list<float >::iterator itr;
44- itr = list2.begin ()
45- *itr = 7 ;
43+ // ? Delete an element from the list at the end
44+ list1.pop_back ();
45+ // ? Delete an element from the list at the front
46+ list1.pop_front ();
47+ display (list1);
48+
49+ // * Create another list
50+ list<int > list2 (3 ); // Empty list of size 3
51+ list<int >::iterator itr;
52+ itr = list2.begin ();
53+ *itr = 7.5 ;
4654 itr++;
47- *itr = 5 ;
55+ *itr = 5.7 ;
4856 itr++;
49- *itr = 75 ;
57+ *itr = 7.5 ;
5058 itr++;
51- display (list2);
59+ // display(list2);
5260
5361 return 0 ;
5462}
You can’t perform that action at this time.
0 commit comments