forked from supershivam13/DataStructures-Algorithms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpair_stl.cpp
More file actions
43 lines (27 loc) · 696 Bytes
/
pair_stl.cpp
File metadata and controls
43 lines (27 loc) · 696 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
43
#include <iostream>
using namespace std;
int main(){
//Pair
pair<int,char> p;
p.first = 10;
p.second = 'B';
//Another way
pair<int,char> p2(p);
cout<< p2.first<<endl;
cout<< p2.second <<endl;
pair<int,string> p3 = make_pair(100,"Audi");
cout<<p3.first<<" "<<p3.second<<endl;
//Take input
int a,b;
cin>>a>>b;
pair<int,int> p4 = make_pair(a,b);
//Array of Pairs
//Vector of Pairs
pair<pair<int,int>, string> car;
car.second = "Audi";
car.first.first = 10;
car.first.second = 20;
cout<<car.first.first<<endl;
cout<<car.second<<endl;
return 0;
}