Skip to content

Commit 039066d

Browse files
committed
add another list
1 parent ad6d1e4 commit 039066d

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

List.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff 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
}
1415
int 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
}

List.exe

7.92 KB
Binary file not shown.

0 commit comments

Comments
 (0)