Ayush Gupta has Published 527 Articles

Operator overloading in C++ to print contents of vector, map, pair ..

Ayush Gupta

Ayush Gupta

Updated on 14-Apr-2020 12:02:26

633 Views

In this tutorial, we will be discussing a program to understand operator overloading in C++ to print contents of vector, map and pair.Operator overloading is the function of operators which gives them the ability to act on User defined objects and work accordingly in a similar fashion.ExampleVector Live Demo#include #include ... Read More

Merge operations using STL in C++ | merge(), includes(), set_union(), set_intersection(), set_difference(), inplace_merge

Ayush Gupta

Ayush Gupta

Updated on 14-Apr-2020 11:58:44

174 Views

In this tutorial, we will be discussing a program to understand the various merge operations using STL in C++.The merge() function is used to merge two sorted containers in a way that the new container is also sorted. Further includes() is used to check if the elements from first container ... Read More

map equal_range() in C++ STL

Ayush Gupta

Ayush Gupta

Updated on 06-Apr-2020 14:19:45

267 Views

In this tutorial, we will be discussing a program to understand map equal_range in C++ STL.This function returns a pair of iterators that bounds the range of the container in which the key equivalent to the given parameter resides.Example Live Demo#include using namespace std; int main() {    //initializing container ... Read More

Maximum of all Subarrays of size k using set in C++ STL

Ayush Gupta

Ayush Gupta

Updated on 06-Apr-2020 14:16:34

250 Views

In this tutorial, we will be discussing a program to get maximum of all subarrays of size k using set in C++ STL.For this we will be provided with a array of size N and integer K. Our task is to get the maximum element in each K elements, add ... Read More

Menu Driven C++ Program for a Simple Calculator

Ayush Gupta

Ayush Gupta

Updated on 06-Apr-2020 14:15:19

1K+ Views

In this tutorial, we will be discussing a program to create a menu driven program for a simple calculator.This program will give user the ability to choose among the following mathematical operations − addition, subtraction, multiplication, division, HCF and LCM.Example Live Demo#include using namespace std; //displaying the menu void menu(){ ... Read More

Multiset in C++ Standard Template Library (STL)

Ayush Gupta

Ayush Gupta

Updated on 06-Apr-2020 14:10:13

252 Views

In this tutorial, we will be discussing a program to understand Multiset in C++ STL (Standard Template Library).Multiset are associative containers much similar to sets. The one difference multiset holds is they can even contain duplicate values.Example Live Demo#include #include #include using namespace std; int main(){    multiset ... Read More

negative_binomial_distribution in C++ with Examples

Ayush Gupta

Ayush Gupta

Updated on 06-Apr-2020 13:58:33

218 Views

In this tutorial, we will be discussing a program to understand negative_binomial_distribution in C++.This function follows the negative Binomial discrete distribution and produces integers according to this random distribution.Example Live Demo#include using namespace std; int main() {    //setting number of experiments    const int exps = 10000;    const ... Read More

multiset max_size() in C++ STL with Examples

Ayush Gupta

Ayush Gupta

Updated on 06-Apr-2020 13:55:35

169 Views

In this tutorial, we will be discussing a program to understand multiset max_size() in C++ STL.The function max_size() returns the maximum number of elements a given container can hold.Example Live Demo#include using namespace std; int main(){    multiset s;    s.insert(10);    s.insert(13);    s.insert(13);    s.insert(25);    s.insert(24);   ... Read More

multiset size() in C++ STL with Examples

Ayush Gupta

Ayush Gupta

Updated on 06-Apr-2020 13:53:28

161 Views

In this tutorial, we will be discussing a program to understand multiset size() in C++ STL.The function size() returns the number of elements present into a given container.Example Live Demo#include using namespace std; int main(){    multiset s;    s.insert(10);    s.insert(13);    cout

order_of_key() in C++

Ayush Gupta

Ayush Gupta

Updated on 06-Apr-2020 13:51:29

879 Views

In this tutorial, we will be discussing a program to understand order_of_key() in C++.The function order_of_key() takes in a key and returns the number of elements which are less than the key provided as parameter in an ordered set.Example Live Demo#include using namespace std; #include #include #include ... Read More

Advertisements