Skip to content

Commit 5bfed93

Browse files
committed
Update Sorting-vectors-deque-and-friend.cpp
1 parent bca65fc commit 5bfed93

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Standard Template Library/Sorting-vectors-deque-and-friend.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,30 @@
66

77
using namespace std;
88

9+
class Test {
10+
int id;
11+
string name;
12+
13+
public:
14+
Test(int id, string name) : id(id), name(name) {}
15+
void print() {
16+
cout << id << " : " << name << endl;
17+
}
18+
};
919

1020

1121
int main() {
1222

23+
vector<Test> tests;
24+
25+
tests.push_back(Test(5, "Mike"));
26+
tests.push_back(Test(10, "Sue"));
27+
tests.push_back(Test(7, "Raj"));
28+
tests.push_back(Test(3, "vicky"));
1329

30+
for (int i = 0; i < tests.size(); i++){
31+
tests[i].print();
32+
}
1433

1534
return 0;
1635
}

0 commit comments

Comments
 (0)