Skip to content

thesahirahmed/c_stl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C++ Standard Template Library (STL)



This project aims to provide a comprehensive explanation of the C++ Standard Template Library (STL). The STL is a powerful set of reusable components that provide data structures and algorithms for efficient programming in C++.

Table of Contents

In the /code folder, you will find examples and explanations of various STL components.

1. Pair

The pair is a fundamental component of the STL that allows you to store two values together as a single entity. It is commonly used to represent key-value pairs or to associate two related values.

Here is an example of how to use the pair in C++:

Click to view code
#include <iostream>
using namespace std;

void learnPair()
{

    pair <int, int> p1;
    cin>>p1.first>>p1.second;
    cout<<"Sum of Two Integer is : "<<p1.first + p1.second<<endl;

    pair<int, int> arr[] = {{1,2},{3,4},{5,6}};
    for(int i=0; i<3; i++)
    {
        cout<<arr[i].first<<" "<<arr[i].second<<endl;
    }
}

int main()
{
    learnPair();
    return 0;
} 

Credits

This project was authored by Sahir Ahmed. Connect with me on LinkedIn:

LinkedIn