 # C++ Programming Code Examples

## C++ > Mathematics Code Examples

### Program to Display Armstrong Number Between Two Intervals

C Language Code Convert Binary to Octal - Program takes a binary number as input and converts to octal. Take a binary number as input. Divide the binary number into groups of 3 bits. For each group of 3 bits, multiply...

A Templated Stack Data Structure sample - Using Templates so that any type of data can be stored in stack without multiple defination of class. Contains "Location of Topmost data" pushed onto stack. Sets the top location to -1

Randomized Primality Testings Algorithm - Method that implements the basic primality test. If witness doesn't return 1, n is definitely composite. Do this by computing a^i (mod n) and looking for "non-trivial" square roots of 1

Swap Array Element and Reverse an Array - To reverse an array in C++ programming, you have to ask to the user to enter the array size and array elements. Now start swapping the array elements. Make a variable say temp of

Encode the String Display Encoded Strings - Read a 'five-letter' Word into the pc, and then encode the word on a letter-by-letter basis by subtracting 30 from the Numerical value that is used to represent each Letter. Thus if ASCII

Program code to Find the Size of a Union - C Define the union named sample. Declare three variables m, n and ch of different data types. Use the keyword sizeof() to find the size of a union and print the same. Initialize

Concatenate 2 Strings C++ Without StrCat - Program which take Two Strings as input and concatenate Two Strings without using string class function "strcat()". There are total three strings, two for 'input' and third for our Result

Matrix Multiplications Mutiply 2 Matrices - Column number of first matrix must be same as the row number of second matrix. Initialize matrix. Print values of the passed matrix and mutiply two matrices and return the resultant