# C++ Programming Code Examples

## C++ > Mathematics Code Examples

### Program to Solve the 0-1 Knapsack Problem

C Multiply two Matrices by Passing Matrix -
C program asks the user to enter the size of the matrix (rows and column). It asks the user to enter the elements of those matrices and finally adds and displays the result. Perform

C Programs Finds Upper Triangular Matrix -
C program to read elements in a matrix and check whether the matrix is upper triangular matrix or not. Check upper triangular matrix. To check whether a matrix is upper triangular

C Code Remove Spaces Blanks from String -
C program remove extra spaces, blanks from the string. Removes 'extra blank spaces' from the given string and returns a new string with single "blank spaces" and skip all consecutive

C Programming Code N-Queen's Problem -
Enter the number of queens(say n) and watch how computer places them in (n x n) matrix such that none can meet another moving along horizontally, vertically or digonally.

Collection of Sorting & Selection Routines -
Shellsort, using Shell's (poor) increments. An Internal method for heapsort. i is the index of an item in the heap. Returns the index of the left child. Internal method for heapsort that is

Reads Input until Enters a Positive Integer -
C Language program to read input until user enters a positive integer. Positive Numbers 1, 2, 3... are known as natural numbers. C code below takes a positive integer (let say n) as...

C++ Searching Using Self-Organizing Lists -
"Self-Organizing" List updates on the basis of 'last searched item'. The sequential searching approach is used. In general search, 80% time only specific 20% of data is accessed. Sample

Simple Calculator using Switch Statement -
This C Program takes an arithmetic operator +, -, *, / and two operands from the user and Performs the Calculation on the 2 operands depending upon the operator entered by the