Skip to content

Commit d02cd8d

Browse files
STL List Capacity Methods
1 parent b660c40 commit d02cd8d

3 files changed

+23
-4
lines changed

output.txt

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
5
2+
10
3+
20
4+
100
5+
100
16
100
2-
200
3-
300
4-
400
5-
500

stl_list_capacity_methods.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
int main()
5+
{
6+
list<int> myList = {10, 20, 30};
7+
// myList.clear();
8+
myList.resize(2);
9+
myList.resize(5, 100);
10+
cout << myList.size() << endl;
11+
12+
for (int val : myList)
13+
{
14+
cout << val << endl;
15+
}
16+
17+
return 0;
18+
}

stl_list_capacity_methods.exe

89 KB
Binary file not shown.

0 commit comments

Comments
 (0)