Find Factorial of a Number using Recursion in C++

First of all, we need to understand the concept of recursion and factorial to write this program. What is Recursion? It is an essential concept in computer science. In computer science, recursion is a process in which a function calls itself directly or indirectly. Recursion function must have the following two properties: What is Factorial?... » read more

How to Check if a Matrix is Invertible using C++

To write this program, we need to understand the concept of invertible. A matrix (A)n ×n is said to be invertible if and only if there exists another matrix (B)n ×n such that AB=BA=ln. A matrix is invertible if and only if its determinant is not zero. A matrix is singular or not invertible if... » read more

Find Factorial of a Number using Iteration in C++

The following is a program to find a factorial of a number using iteration in C++. To write this program, first of all, we need to understand the concept of factorial. What is Factorial? Factorial is represented by an exclamation mark (!). Factorial of n number is the product of all integers greater than or... » read more

Simulate a ‘N’ Roller Dice using C++

A dice roller grants you to roll a constructive dice. It is used to generate a sequence of random number mainly use in gambling games like Backgammon, sic bo or Yahtzee. A computational device uses to create a series of random symbols or numbers with lack of any pattern. How to simulate a Roller Dice... » read more

An encoding of a message using matrix multiplication in C++

Encoding is performed between a given matrix and key matrix using matrix multiplication. We included header file conio.h to use getch() function which is used to stop the output screen from blinking. Message encoding using matrix multiplication in C++ Below is a C++ program that an encoding of a message using matrix Multiplication. This program... » read more

Perform Matrix Multiplication using C++

Below is a C++ program to perform Matrix Multiplication. This program is successfully compiled, and the output is also given below. Matrix Multiplication in C++ #include<iostream> using namespace std; int main () { int row1, clum1, row2, clum2; int i, j, k; int X[8][8], Y[8][8], Z[8][8]; cout << "Please Enter Rows and Columns Of Mateix... » read more

Implementation of Binary Trees in C++

A binary tree is a data structure with a finite set of nodes consisting of: A unique node with no parents called root and zero or more subtrees. Every node can be connected to an arbitrary number of nodes, called children. Nodes with no children are called external nodes or leaves. Internal nodes are the... » read more

Search an element in Binary Search Tree using C++

The Binary search tree is a data structure consisting of nodes. The nodes are either null or have reference to other (child) nodes. Every node can have up to 2 nodes, called the left node or the right node. Each node will also contain a value, which will determine where these nodes are placed within... » read more

Implementation of Radix Sort in C++

Radix sort is a sorting algorithm that is used to sort numbers. For example, if we are dealing with unsorted numbers, we know that these numbers are formed using digits from 0 to 9. So we need ten places labeled 0 to 9 to unsorted numbers. Radix Sort in C++ So, let’s get started with... » read more

Count Inversion in an Array using C++

The inversions of an array show; how many shifts/turns are needed to turn the array into its sorted form. Inversion Count for an array points out how nearest the array is from being sorted. If an array is already in sorted form, then count inversion 0. Count inversion shall be maximum if the sorted array... » read more

Functional Programming in C++

We all know C++ as Object Oriented Programming language but just like many other widely used object-oriented languages (Java, C# etc), C++ is slowly adopting more features related to functional languages. Its default behavior is imperative but you can write code in a functional style in C++ even more easily than other pure imperative languages... » read more

Calculate Average of Numbers in Arrays using C++

The sample code below is to demonstrate how to calculate the average of integer numbers in an array using C++. It’s a console application that takes the ‘n’ as an argument, which is the number of element to be stored in an array, then calculates the average of those numbers. How does this program work?... » read more