Skip to content

Commit 0bca5de

Browse files
parmeet9891abranhe
authored andcommitted
Add files via upload
1 parent f843a6a commit 0bca5de

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

data-structures/Inbuilt_Pair.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
Pair is a container class in CPP defined in <utility> header file. It consists of two elements.
3+
4+
You can access the first element as 'first' and second element as 'second'. They both can be of any data type. (This class is made using templates)
5+
6+
We can use the pair class where we need to store two properties like when finding diameter of a binary tree.
7+
8+
This is the inbuilt version, we can create our own version too.
9+
10+
*/
11+
#include<bits/stdc++.h>
12+
using namespace std;
13+
14+
int main() {
15+
16+
pair <int, char> p ;
17+
18+
p.first = 100;
19+
p.second = 'G' ;
20+
21+
cout << p.first << " " ;
22+
cout << p.second << endl ;
23+
24+
return 0;
25+
26+
}
27+
28+

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy