 # C++ Programming Code Examples

## C++ > Mathematics Code Examples

### C++ Program to Multiply two Numbers

Generates Random Directed Acyclic Graph - This algorithm takes the input of the number of edges 'e' in the random "DAG". It connects 2 'Random Vertexes' and checks for any cycle generated due to this edge. If yes discard this

Constant Definition by use const Keyword - What are "Constants"? Constants refer to as fixed values, unlike variables whose value can be altered, constants -- as the name implies does not change, they remain constant. And

Implement Dijkstra's Algorithm Using Set - This is a C++ Program to find "shortest path". Dijkstra's algorithm is very similar to Prim's algorithm for minimum spanning tree. Like "Prim's MST", we generate a SPT with given

C Program Reverse a String Use Recursion - Program reverse the string 'Using Recursion'. C program uses recursive function & reverses the string in the same 'Memory Location'. Eg 'Superman8' will be reversed to '8namrepuS'

Alternate Nodes in linked list by Recursion - Print the alternate nodes in a linked list using recursion. Program, using recursion, displays the alternate nodes in a Linked List. A linked list is an "ordered set" of data elements, each

Program code to Reverse a Given Number - Take the Number which you have to Reverse as the input. Obtain its quotient & remainder. Multiply the separate variable with 10 & add the obtained remainder to it. Do step 2 again

If Else If Statement & Multiple Conditions - In this control structure we have only one 'if' and one 'else', however we can have multiple 'else if' blocks. This is how it looks: If none of the 'condition is true' then these statements

Find the volume & surface area of cuboids - This C Program to calculates the volume and surface area of cuboids. The Formula used in this program are surfacerea= 2(w * l + l * h + h * w) where w is Width & l is Length and h is