-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path24.cpp
More file actions
42 lines (28 loc) · 762 Bytes
/
Copy path24.cpp
File metadata and controls
42 lines (28 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <bits/stdc++.h>
using namespace std;
int main() {
vector<int> v = {2, 3, 5, 6, 7};
// another way of printing a vector
// for(int value : v){
// // here also vector values are passed by value
// cout<<value<<" ";
// }
// for(int &value : v){
// // thus use &, do pass by reference
// cout<<value<<" ";
// }
vector<pair<int, int>> v_p = {{1, 2}, {2, 3}};
// for (pair<int, int> &value : v_p)
// {
// cout<<value.first<<" "<<value.second<<"\n";
// }
for (auto it = v.begin(); it != v.end(); it++)
{
cout<<*it<<" ";
}
for (auto &value : v_p)
{
cout<<value.first<<" "<<value.second<<"\n";
}
return 0;
}