
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7197 Articles for C++

213 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 gquiz1; //inserting values gquiz1.insert(40); gquiz1.insert(30); gquiz1.insert(60); gquiz1.insert(20); gquiz1.insert(50); gquiz1.insert(50); gquiz1.insert(10); multiset :: iterator itr; cout

351 Views
In this tutorial, we will be discussing a program to understand multiset lower_bound() in C++ STL.The function lower_bound() returns the first existence of the element in the container equivalent to the provided parameter, else it returns the element immediately bigger than that.Example Live Demo#include using namespace std; int main(){ multiset s; s.insert(1); s.insert(2); s.insert(2); s.insert(1); s.insert(4); cout

347 Views
In this tutorial, we will be discussing a program to understand multiset upper_bound() in C++ STL.The function upper_bound() returns the pointer to an element which is bigger than the one provided as a parameter, else it returns the pointer to the last element in the container.Example Live Demo#include using namespace std; int main(){ multiset s; s.insert(1); s.insert(3); s.insert(3); s.insert(5); s.insert(4); cout

187 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 int numberstars = 100; default_random_engine generator; negative_binomial_distribution distribution(4, 0.5); int p[10] = {}; for (int i = 0; i < exps; ++i) { int counting = distribution(generator); if (counting < 10) ++p[counting]; } cout

137 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); cout

123 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

824 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 #include using namespace __gnu_pbds; using namespace std; //initializing ordered set typedef tree ordered_set; int main(){ ordered_set mySet; mySet.insert(5); mySet.insert(2); mySet.insert(6); mySet.insert(4); cout

262 Views
In this tutorial, we will be discussing a program to understand MakeFile in C++ and its applications.The task is to break the entire program with MakeFile. It is usually done by making .cpp files and .h files with all the classes/functionalities and link them together.Examplemain.cpp#include #include "function.h" using namespace std; //main execution program int main(){ int num1 = 1; int num2 = 2; cout

489 Views
In this tutorial, we will be discussing a program to understand Kruskal’s minimum spanning tree using STL in C++.For this, we will be provided with a connected, undirected and weighted graph. Our task is to calculate the Minimum spanning tree for the given graph.Example Live Demo#include using namespace std; typedef pair iPair; //structure for graph struct Graph{ int V, E; vector< pair > edges; Graph(int V, int E){ this->V = V; this->E = E; } void addEdge(int u, int v, int w){ edges.push_back({w, {u, v}}); } ... Read More

315 Views
In this tutorial, we will be discussing a program to understand the lower bound in C++.lower_bound() method in C++ is used to return the very first number in the container object which is not less than the given value.Example Live Demo#include int main(){ std::vector v{ 10, 20, 30, 40, 50 }; std::cout