# C++ Programming Code Examples

## C++ > Mathematics Code Examples

### C++ Program to Add Two Numbers

Trim Leading & Trailing white spaces from -
I already explained how to remove leading as well as trailing white space characters from a given string. In this program we will Combine the logic of both in a single program. Logic to

Perform Unique Factorization of Numbers -
Program finds the Unique paritions of a given integer such that addition of a partition result an integer. A positive integer n, "generate" all possible unique ways to represent n as sum of

C++ & Encapsulations Represents Binding -
"Encapsulation" represents binding data and functions into one container. Container hides the details of the data and the way functions process data. In C++, Class is a container that

C Code Increment & Decrement Operators -
C programming language has two operators increment ++ and decrement -- to change the value of an operand (constant or variable) by 1. Increment ++ increases value by 1 whereas

Implement Slicker Algorithm that Avoids -
Program to find the "Area of Ploygon" using "Slicker Algorithm". algorithm assumes the usual mathematical convention that positive y points upwards. Enter the number of points

Program Generate All the Set Partitions of -
This algorithm takes the 'Input of the Natural' number and prints all the possible partition of each number less than or equal to it. For each number, it starts with the number and breaks

C++ Swap Two Numbers Using 3. Variable -
Swap numbers means exchange the values of two variables with each other. Variable num1 contains 20 and num2 contains 40 after swap there values num1 contains 40 num2 contains

Generate All Possible Subsets With Exactly -
Algorithm takes the input of "n" data element and 'prints all possible' combination of length 'k'. It maintains a boolean array of length 'n'. If the corresponding boolean value is true, then