-
Notifications
You must be signed in to change notification settings - Fork 0
/
f_RangeBaseOrAuto.cpp
42 lines (30 loc) · 955 Bytes
/
f_RangeBaseOrAuto.cpp
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>ans = {1,2,3,4,5};
// for(int value : ans)//Here value is worked as a copy variable if we change something in value
// { //it will not reflect to the main value.
// value++;
// }
// //To make the changes in value variable also in the actuall value then make value as a reference variable.
// for(int &value : ans)
// {
// value++;
// }
// for(int value:ans)
// {
// cout<<value<<" ";
// }
//auto --> it will automatically decide the dataType and return accordingly.
// for(auto it:ans)
// {
// cout<<it<<" ";
// }
//Using auto with vector pairs
// vector<pair<int,int>>ans={{1,2},{3,4},{4,5},{7,8}};
// for(auto it : ans)
// {
// cout<<it.first<<" "<<it.second<<endl;
// }
}