# C++ Programming Code Examples

## C++ > Mathematics Code Examples

### Generate Random Numbers Using Middle Square Method

C Code Finds the Sum of all Nodes in Tree -
C Program finds the sum of all nodes in a tree such that any node is sum of values at left and right sub tree. Function to find depth of a tree. Function to modify the tree. Function to

C Code Reads a Number of Objects by Size -
Reads a number of objects by size and stores them in buf. C programming code returns the number of items actually read. Get open a file and read. If there is an error give a message.

C Command Line arguments parameters -
C code to Open command prompt inside Borland C/C++. Click on DOS Shell. Inside command prompt type this command. Type "exit" command to return to Turbo C/C++

C++ Code Convert Hexadecimal to Binary -
To convert "Hexadecimal" number to "binary" number in C++, you have to ask to the user to enter the hexadecimal number to convert it into binary number to display the equivalent

A Calculator by Switch Case and Functions -
Create menu driven Calculator that performs basic mathematic operations (Add, Subtract, Multiply, Divide) use switch case & functions. The calculator should input two numbers and

Undirected Graph is Connected Using DFS -
A "Recursive Function" to print 'DFS' starting from v. Returns reverse ('or transpose') of this graph. Add edge to connect v and w. Check if Graph is Connected and display 'The Graph is

Types of functions in The C Programming -
Predefined standard library functions - such as puts(), gets(), printf(), scanf()... These are the functions which already have a definition in header files (.h files like stdio.h), so we just

C Program code Generate Fibonacci Series -
Generates fibonacci series. In fibonacci series the first 2 numbers in the Fibonacci sequence are 0, 1, each Subsequent Number is the sum of the previous two. Example 0, 1, 1, 2, 3, 5, 8,