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
 
C++ Articles - Page 414 of 719
 
			
			366 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
 
			
			364 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
 
			
			196 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
 
			
			153 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
 
			
			137 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
 
			
			845 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
 
			
			270 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
 
			
			513 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
 
			
			327 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
 
			
			749 Views
In this tutorial, we will be discussing a program to understand how to read the alternate nth byte and write it in another file.For this, we will be provided with two .txt files. Our task is to write the contents from one file to another file using Iseek() which is used to change the pointer of the file descriptor.Example#include #include #include #include void func(char arr[], int n){ int f_write = open("start.txt", O_RDONLY); int f_read = open("end.txt", O_WRONLY); int count = 0; while (read(f_write, arr, 1)){ if (count < n) ... Read More