
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++

136 Views
With respect of a given number, display or print all possible combinations of strings that can be implemented to dial the given number in a phone with the help of following pecifications.In the given phone, we can dial, 2 implementing A or B or C, 3 implementing D or E or F, ……………….8 implementing T or U or V, 9 implementing W or X or Y or Z, 1 implementing only 10 implementing 0.For example if 89, is the given phone number, the program should printTW, TX, TY, TZ, UW, UX, UY, UZ, VW, VX, VY, VZ#include #include ... Read More

311 Views
We know that ternary operator is implemented instead of if..else clause. It is denoted by ?: . '?' symbol is equivalent to if part and ':' is equivalent to else part. The following 3 programs explain some interesting observation in case of ternary operator.The following program is able to compile without any error. Ternary expression’s return type is expected to be float (as that of exp2) and exp3 (i.e. literal zero - int type) is able to implicitly convert to float.#include using namespace std; int main(){ int test1 = 0; float fvalue = 3.111f; cout

444 Views
It is already cleared that the BASH fork bomb is much more powerful than its version of C program. The main cause is that in BASH the created process is detached from the parent. If the parent process (the one we initially started) is destroyed or killed, the remaining or rest of the processes live on. But in case of the C implementation, the listed child processes die automatically if the parent is destroyed or killed. A script is responsible to communicate with the system directly.The fork bomb program in C can be updated or modified. We can be able ... Read More

236 Views
In this tutorial, we will be discussing a program to find the coordinates of rectanglewith given points lying inside.For this we will be provided with some coordinate points. Our task is to find the smallest rectangle such that all the points lie inside it and it should have its sides parallel to the coordinate axis.Example Live Demo#include using namespace std; //calculating the coordinates of smallest rectangle void print_rectangle(int X[], int Y[], int n){ //finding minimum and maximum points int Xmax = *max_element(X, X + n); int Xmin = *min_element(X, X + n); int Ymax = *max_element(Y, ... Read More

1K+ Views
In this tutorial, we will be discussing a program to find the convex hull of a given set of points.Convex hull is the smallest polygon convex figure containing all the given points either on the boundary on inside the figure.In this program, we will use brute force to divide the given points into smaller segments and then finally merging the ones that follow on to construct the convex hull.Example Live Demo#include using namespace std; //storing the center point of polygon pair mid; //calculating the quadrant of //a particular point int quad(pair p){ if (p.first >= 0 && p.second >= 0) ... Read More

221 Views
In this tutorial, we will be discussing a program to find the convex hull of a given set of points.Convex hull is the smallest polygon convex figure containing all the given points either on the boundary on inside the figure.Example Live Demo#include #define llu long long int using namespace std; //structure for the given point struct Point { llu x, y; bool operator= t && calc_crossproduct(ans[k - 2], ans[k - 1], A[i - 1])

964 Views
In this tutorial, we will be discussing a program to find the convex hull of a given set of points.Convex hull is the smallest polygon convex figure containing all the given points either on the boundary on inside the figure.In Graham Scan, firstly the pointes are sorted to get to the bottommost point. Then the points are traversed in order and discarded or accepted to be on the boundary on the basis of their order.Example#include #include #include using namespace std; struct Point{ int x, y; }; //point reference for sorting other points Point p0; //moving to ... Read More

443 Views
In this tutorial, we will be discussing a program to copy set bits of one number to another in the given range.For this we will be provided with two integers. Our task is to see the bits in the first number and set those bits in the second number as well if they are in the given range. Finally returning the digit produced.Example Live Demo#include using namespace std; //copying set bits from y to x void copySetBits(unsigned &x, unsigned y, unsigned l, unsigned r){ //l and r should be between 1 and 32 if (l < 1 || ... Read More

278 Views
In many cases, we need to verify the value of something returned by a function and perform conditional operations based on this value. So our code is given below −// Some method or function return_type foo(Params) // Call function with Params and // store return in var1 auto var1 = foo(Params); if (var1 == /* some value */) { //Perform Something } else { //Perform Something else }Just follow the general format in all conditional if-else blocks. Firstly there is exist an optional initial statement which sets up the variable, followed by the if-else block. So the general ... Read More

1K+ Views
An AA tree in computer science is defined as a form of balanced tree implemented for storing and retrieving ordered data efficiently. AA trees are treated as a variation of the red-black tree, a form of binary search tree which supports efficient addition and deletion of entries. As opposed to red-black trees, red nodes on an AA tree can only be added as a right subchild, no left subchild. The result of this operation is the simulation of a 2-3 tree instead of a 2-3-4 tree, which causes simplification the maintenance operations. The maintenance algorithms for a red-black tree require ... Read More