pairs in c++

C++
// make_pair example
#include <utility>      // std::pair
#include <iostream>     // std::cout

int main () {
  std::pair <int,int> foo;
  std::pair <int,int> bar;

  foo = std::make_pair (10,20);
  bar = std::make_pair (10.5,'A'); // ok: implicit conversion from pair<double,char>

  std::cout << "foo: " << foo.first << ", " << foo.second << '\n';
  std::cout << "bar: " << bar.first << ", " << bar.second << '\n';

  return 0;
}//CPP program to illustrate auto-initializing of pair STL 
#include <iostream> 
#include <utility> 
  
using namespace std; 
  
int main() 
{ 
    pair <int, double> PAIR1 ; 
    pair <string, char> PAIR2 ; 
  
    cout << PAIR1.first ;  //it is initialised to 0 
    cout << PAIR1.second ; //it is initialised to 0 
  
    cout << " "; 
  
    cout << PAIR2.first ;  //it prints nothing i.e NULL 
    cout << PAIR2.second ; //it prints nothing i.e NULL 
  
    return 0; 
} 

Source

Also in C++: