# C++ Programming Code Examples

## C++ > Arrays and Matrices Code Examples

### Matrix Multiplication 2D (dimensional) Array

C++ Random Numbers the Middle Square -
This C++ Program generate random numbers using Middle Square method. In practice it is not a good method, since its period is usually very short & it has some severe 'weaknesses',

Solves Tower of Hanoi Problem Recursion -
C Program uses recursive function and solves the "Tower of Hanoi". The tower of hanoi is a mathematical puzzle. It consists of threerods, and a number of disks of different sizes which

Program code to addition of two matrices -
Before accepting the Elements Check if no of rows and columns of both matrices is equal. Accept the Elements in Matrix 1 and Matrix 2. Addition of two matrices. Print out the matrix

C Evaluate the Given Polynomial Equation -
C program to evaluate a given polynomial by reading its coefficients in an array. Formula is P(x)=AnXn + An-1Xn-1 + An-2Xn-2+... +A1X + A0. The 'polynomial' can be written as: P(x) =

C++ Programming Simple Stack Program -
A "stack" is a basic data structure and can be defined in an abstract, implementation-free manner, or it can be generally "defined" as a linear list of items in which all additions and

C Programming calculator use Switch Case -
Step by step descriptive logic to create menu driven calculator that performs all basic math operations. Input 2 numbers and a Character from user in the given format. Store them in

C Program Print Odd Numbers in a Range -
C program to print all odd numbers from 1 to n using for loop. Input lower and upper limit from user. If start is not odd then make it odd And Initialize loop from start, increment it by

Calculates Area & Circumference of Circle -
To calculate area and circumference we must know the radius of circle. C program code will prompt user to enter the radius and based on the input it would calculate the values. Make