# C++ Programming Code Examples

## C++ > Code Snippets Code Examples

### C++ break - The break keyword is used to stop a loop

Code Get Highest Order Set Bit of Number -
Highest position of a set bit from left to right in a number is said to be highest order set bit of that number. Highest order set bit of any negative integers is 31. Since, highest order...

C Program Codes Calculates Electricity Bill -
Program to find electricity bill using if else in C. Input unit consumed by customer in some variable say unit and if unit consumed less or equal to 50 units. Then amt = unit * 0.50. Unit

C++ Compute Combinations by Factorials -
Prints a total number of combination possible for given n and r value. The "time complexity" of this algorithm is O(n). This algorithm takes the input of n and r value. Function to find the

Swaps Array Elements and Reverse Arrays -
Program declare an integer array of size five, initialize it using for loop. Pass size and array name to function. Function uses for loop and "swap array elements" with in it. A for loop is

C++ Program Three Dimensional 3D Array -
3D array contains three for loops. to initialize and "print three dimensional" array, you have to use three for loops. Third for loop forms 1D array, Second for loop forms 2D array and the

Use If Else Statements C++ Programming -
In sometimes you have a "condition" and you want to execute a block of code if condition is true and execute another piece of code if the same condition is false. This can be achieved

C Programming to Multiply Two Matrices -
C Code to Multiply Two Matrices. How many rows in the first matrix? How many cols in the first matrix? How many rows in the second matrix? How many cols in the second matrix?

C Program Code to Sort Array of Structure -
Problem to display the highest literate rate and the highest income of a state using array of structures. Firstly accept total number of states so that we can accept all the details...