
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 33676 Articles for Programming

1K+ Views
In this program a random graph is generated for random vertices and edges. The time complexity of this program is O(v * e). Where v is the number of vertices and e is the number of edges.AlgorithmBegin Develop a function GenRandomGraphs(), with ‘e’ as the number of edges and ‘v’ as the number of vertexes, in the argument list. Assign random values to the number of vertex and edges of the graph, using rand() function. Print the connections of each vertex, irrespective of the direction. ... Read More

202 Views
Here is a C++ Program to get all the unique factorization of a given integer such that addition of a partition results an integer. In this program, a positive integer n is given, and we shall generate all possible unique ways to represent n as sum of positive integers. Algorithm to Perform Unique Factorization Below is the algorithm to perform the unique factorization of a given number: Begin function displayAllUniqueParts(int m): 1) Set Index of last element k in a partition to 0 ... Read More

3K+ Views
Nowadays the compiler comes with default 64-bit version. Sometimes we need to compile and execute a code into some 32bit system. In that time, we have to use this feature.At first, we have to check the current target version of the gcc compiler. To check this, we have to type this command.gcc –v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu ........... ........... ...........Here it is showing that Target is x86_64. So we are using the 64-bit version of gcc. Now to use the 32-bit system, we have to write the following command.gcc –m32 program_name.cSometimes this command may generate ... Read More

177 Views
In C or C++, there are four different datatypes, that are used for integer type data. These four datatypes are short, int, long and long long. Each of these datatypes takes different memory spaces. The size varies in different architecture and different operating systems. Sometimes int takes 4-bytes or sometimes it takes 2-bytes. This also happen for the compilers. So we can use cross compilers.The cross compilers are basically a compiler, which is capable of compiling for a platform other than current platform.So if we want to compile the following code in 32bit system, and 64-bit system, it will generate ... Read More

1K+ Views
Sometimes we need variable number of inputs in our program. In this program we will see how to use cin to take variable number of inputs.The simple solution is run a loop, and when one specific value is pressed, it stops. The another idea is using the cin >> input. This will return false when value is non-numeric.Example#include using namespace std; main() { int input; int n = 0; cout > input) n++; cout

218 Views
C++ fdim() Function The fdim() function returns the positive difference between two floating-point values. For example, if we have two arguments, a and b, respectively, then it will return a-b if a > b, else it will return 0. This function is defined under or header files and supports float, double, and long double overloads. Syntax Here is the following syntax for fdim() function in C++. In the following syntax, data_type defines the type of data it will take as input and return. data_type fdim(data_type value_1, data_type value_2); Parameters This method accepts two parameters of floating type (i.e., can ... Read More

582 Views
The fmax() and fmin() functions in C++ are used to check the maximum or minimum of two floating-point numbers. These functions are defined under the header file of the C++ standard library. C++ fmax() function The fmax() is used to compare and return the larger of two floating-point values. These floating point values can be float, double, and long double. Syntax data_type fmax(data_type value_1, data_type value_2); Here, data_type could be float, double and long double. C++ fmin() function The fmin() is used to compare and return the smaller of two floating-point values. These floating point values can be float, ... Read More

1K+ Views
Here we will see what is the constructor delegation? When a constructor calls other constructor of the same class, then it is called the constructor delegation. This feature is present from C++11.Let us see the following program, and try to analyze what are the difficulties in this code.Example#include using namespace std; class MyClass { int a, b, c; public: MyClass(){ a = b = c = 0; } MyClass(int c) { // Initializing a and b are redundent, only c initialization is needed here a = 0; b = 0; this->c = c; } void display(){ cout

906 Views
Here we will see how we can make a set for user defined datatypes. The Set is present in C++ STL. This is a special type of data structure, it can store data in sorted order, and does not support duplicate entry. We can use set for any type of data, but here we will see how we can also use set for userdefined datatypes.To use user-defined datatypes into stack, we have to override < operator, that can compare two values of that type. If this is not present, it cannot compare two objects, so the set cannot store data ... Read More

2K+ Views
In some cases, especially in competitive programming, we may need to specify the minimum or maximum value of a specific datatype. In C++, each data type has a different memory range under which we can define and declare the value of that data type. But it becomes difficult to remember all the large ranges of each data type. So, C++ has introduced the macros that are used to represent the minimum and maximum range of some datatype. And some data types do not have macros for minimum values, because they are unsigned (means, hold only positive value). So, as their ... Read More