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

152 Views
In C++, there are some undefined behaviors. These are identified by doing some tasks in C++. There are no such direct definitions. These few things should be known to all of the programmers, who want to use C++ for different purposes.Here we will see some C++ Codes. and try to guess the results. The codes will generate some runtime errors.The Divide By Zero error is undefined.Example Code#include using namespace std; int main() { int x = 10, y = 0; int z = x / y; cout

447 Views
Here we will see some good tricks of C++ programming language that can help us in different area. Like if we want to participate in some competitive programming events, then these tricks will help us to reduce the time for writing codes. Let us see some of these examples one by one.Checking whether a number is odd or even without using % operator. This trick is simple. We can perform bitwise AND operation with the number and 1. If the result is non-zero then this is odd, otherwise this is even. The logic is too simple. All odd numbers have ... Read More

243 Views
Zooming digits means printing the digits of a given number in an enlarged form using special characters. In this article, we will learn to print (display) enlarged (zoomed) form of the digits of a given number. Below is the representation of digits 01438 in zoom format, Example of Zoom Digits in Integers Form To generate the zoomed digit, we define the pattern logic for each digit based on its respective function prototype. Then, we create a function that sets the switch-case logic which processes the selected digit based on either user input or a given number. In this example, ... Read More

247 Views
In this program we will count the number of ways one number can be represented by sum of numbers smaller than itself. This program will count the partition of given numbers. We take a number n as input, then starting from a number break it by removing 1 at a time. If the new partition is generated, increase the counter.AlgorithmpartitionCount(n)Input : The number nOutput : The number of partitionsBegin Create array p of size n k := 0 count := -1 put n as the first element of array p Repeat the following steps, do ... Read More

680 Views
In this section we will see how to find the area of a triangle in 2D coordinate space using matrix determinants. In this case we are considering the space is 2D. So we are putting each points in the matrix. Putting x values at the first column, y into the second and taking 1 as the third column. Then find the determinant of them. The area of the triangle will be half of the determinant value. If the determinant is negative, then simply take the absolute value of it.$$Area\:=\:absolute\:of\begin{pmatrix}\frac{1}{2} \begin{vmatrix} x_1\:\:y_1\:\:1 \ x_2\:\:y_2\:\:1 \ x_3\:\:y_3\:\:1 \end{vmatrix} \end{pmatrix}$$Here we are assuming ... Read More

897 Views
In C++, the templates are used to create generalized functions and classes. So we can use any type of data like int, char, float, or some user defined data also using templates.In this section, we will see how to use the template specialization. So now we can define some generalized template for different types of data. And some special template function for special type of data. Let us see some example to get better idea.Example Code#include using namespace std; template void my_function(T x) { cout

2K+ Views
Templates are the foundation of generic programming, which involves writing code in a way that is independent of any particular type.A template is a blueprint or formula for creating a generic class or a function. The library containers like iterators and algorithms are examples of generic programming and have been developed using template concept.There is a single definition of each container, such as vector, but we can define many different kinds of vectors for example, vector or vector .Example Code#include #include using namespace std; template inline T const& Max (T const& a, T const& b) { ... Read More

2K+ Views
We can arrange the characters of a string in different order. Here we will see how we can count the number of permutations can be formed from a given string.We know that if one string is ‘abc’. It has three characters; we can arrange them into 3! = 6 different ways. So a string with n characters, we can arrange them into n! different ways. But now if there are same characters are present for multiple times, like aab, then there will not be 6 permutations.abaaabbaabaaaababaHere the (1, 6), (2, 5), (3, 4) are same. So here the number of ... Read More

298 Views
Here we will see how to list the modified files and old and newly created files on Linux platform using C++ program.The task is very simple. We can use the Linux shell command to get the files in desired order. The ls –l command is used to get all of the files in long listing format. Here we will add more options to sort them based on time. (Ascending and Descending). The –t command is used to sort based on time, and –r can be added to reverse the sequence.The command will be like below:ls –lt ls –ltrWe will use ... Read More

536 Views
The Euler path is a path using which we can visit every edge exactly once in a graph. The same vertex can be used for multiple times. The source and destination nodes in the Euler path are different. If the source and destination node become the same, then the Eulerian path is also an Eulerian cycle. In this article, our task is to check if there exists an Eulerian path in the given directed graph. Example of Eulerian Path The figure below displays that an Eulerian path exists in the given directed graph. We can see that the starting ... Read More