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
Server Side Programming Articles - Page 1840 of 2650
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(){ cout
233 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
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
362 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
151 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
136 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
841 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
836 Views
The below lines of code can be used, wherein UTF-8 input is expected.$chr_map = array( // Windows codepage 1252 "\xC2\x82" => "'", // U+0082⇒U+201A single low-9 quotation mark "\xC2\x84" => '"', // U+0084⇒U+201E double low-9 quotation mark "\xC2\x8B" => "'", // U+008B⇒U+2039 single left-pointing angle quotation mark "\xC2\x91" => "'", // U+0091⇒U+2018 left single quotation mark "\xC2\x92" => "'", // U+0092⇒U+2019 right single quotation mark "\xC2\x93" => '"', // U+0093⇒U+201C left double quotation mark "\xC2\x94" => '"', // U+0094⇒U+201D right double quotation mark "\xC2\x9B" => "'", // U+009B⇒U+203A single right-pointing angle ... Read More
398 Views
A PHP reference is an alias, that allows two different variables to write it to the same value. In PHP version 5, an object variable doesn't contain the object itself as its value. It holds an object identifier that allows object accessors to find the actual object.When an object is sent by an argument, returned or assigned to a different variable, these different variables are not aliases. They contain a copy of the identifier, that points to the same object.Example$my_var = new class_name; echo $my_var->get_class_name(5)->value; $my_var->test(); echo $my_var->get_class_name(5)->value;OutputThis will produce the following output −class_name #5This isn't "pass by reference". It ... Read More