 # C++ Programming Code Examples

## C++ > Algorithms Code Examples

### Accessing SQL Server from C++

Code find sum of main diagonal elements - Read elements in a matrix and find the sum of main diagonal (major diagonal) elements of matrix. Find sum of all elements of main diagonal of a matrix. Input elements in the

C Program to Find Smallest array element - Finding smallest value in an Array is a classic C array program. C code gives you an insight of iteration, array and conditional operators. We iteratively check each element of array...

Checking Whether Number is Even or Odd - In this example, if...else statement is used to check whether a number entered by the user is "even or odd". Integers which are perfectly "divisible by 2" are called even numbers. And

Program Represent Graph Using 2D Array - Algorithm takes the input of the number of vertex & edges. Take the input of connected vertex pairs. Print the graph using 2D arrays. A function to "print the matrix". Print 1 if the

C++ Program Codes Print Prime Numbers - For example, to print prime number between '3 to 29', here 3 is the starting number and 29 is the ending number, enter the starting and ending number to find and print all the prime

Perform Edge coloring on Complete graph - This algorithm takes the input of the number of vertexes. Construct a complete graph for v vertex. So it assigns a color to edges without assigning the same color to 2 adjacent edges.

If Statement Check the Number is Less or - The statements inside if parenthesis (usually referred as if body) gets executed only when the given condition is true. If the condition is false then the statements "inside if body" are

UnOrdered Permutation Algorithm in C++ - It initializes the value current level, permutes the remaining values to the 'higher levels'. As the Assigning Action of the values reaches to the "Highest Level", it prints the permutation