# C++ Programming Code Examples

## C++ > Arrays and Matrices Code Examples

### Simple Class Template Array Program: Search Number

Find Sum of Natural Numbers While Loop -
The "Positive Numbers" 1, 2, 3... are known as natural numbers. The C program codes below takes a positive integer ( let say n ) as an input from the user and calculates the sum up to n.

C++ Implementations Binary Search Tree -
Insert x into the tree; duplicates are ignored. Remove x from the tree. Nothing is done if x is not found. Find the "smallest item" in the tree. Find the "largest item" in the tree. Find

C Mirror Image of Right Angled Triangles -
'Pyramid program' in C Programming. Mirror image of right angled triangle. "space_count" variable is used as 'Subscript Variable' used in for loop. 'noofspaces' variable is used to keep

C++ Program to Implement Pairing Heap -
In this, Insert item x into the 'priority queue', maintaining heap order. Return a pointer to the node containing the new item. Find the 'smallest' item in the priority queue. Return

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',

C Programs Calculates the Area of a Circle -
C Language Program calculates the Area of a Circle given it's Radius. Lets use The formula to compute the 'area' is: Area = ? x r2 where r is the radius of the circle & ? value is 22/7. 'Pi'

C Display Nodes of a Linked list in Reverse -
C Program uses recursive function & reverses the nodes in a Linked list and displays the list. Linked list is an ordered set of data elements, each 'containing a link' to its successor. This C

Check a Number is Positive Negative or 0 -
We will use the above logic inside if to check number for Negative, Positive or Zero. Step by step Descriptive Logic to check negative, positive or zero. Input a number from user in