# C++ Programming Code Examples

## C++ > Arrays and Matrices Code Examples

### Program to Find Transpose of a Matrix

Takes octal number as input and converts -
C Program take the octal number as input and store it in the variable octal. Initialize the variables decimal and j to zero. Obtain the remainder and quotient of the octal number.

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

Code find first & last digit of any number -
C program to input a number from user and find first and last digit of number using loop. Before I explain logic to find first digit, let us first learn to find last digit of a number. Find

C Language Code Display Prime Numbers -
Any whole number which is Greater than 1 & has only two factors that is 1 and the number itself, is called a "Prime Number". Other than these two number it has No Positive Divisor.

Simple Programs Area Of Square Formula -
The second power was described in terms of the area of a square, as in the above formula. It led to the use of the term square to mean raising to the "second power". Thus the area

Efficient Implementations of Disjoint Sets -
numElements is the initial number of disjoint sets. Union "Two Disjoint" sets. For simplicity, we assume "root1 and root2" are distinct and represent set names. "root1" is the root of set

Switch Statement Calculates Grade Points -
A simple c++ program which shows using of switch statement in c++. C++ Program which takes input a grade and display Grade Points Average GPA. Program takes inputs A,a, B,b,

Checks If the Substring is Present in String -
C Program 'checks the substring' is present in a given string. Program accepts both string & substring. Then checks whether the substring is present in the string. Enter search substring