- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Pair in C++ Standard Template Library (STL)
In this tutorial, we will be discussing a program to understand pair in C++ Standard Template Library.
Pair is a container defined in the utility header that contains two values. It is used to combine two values and associate them even if they are of different types.
Example
#include <iostream> #include <utility> using namespace std; int main(){ //initializing a pair pair <int, char> PAIR1 ; PAIR1.first = 100; PAIR1.second = 'G' ; cout << PAIR1.first << " " ; cout << PAIR1.second << endl ; return 0; }
Output
100 G
Advertisements