# C++ Programming Code Examples

## C++ > Arrays and Matrices Code Examples

### Program to Count Inversion in an Array

Quick Sort with the Complexity Constraint -
Randomly select pivot value from the subpart of the array. Partition that subpart so that the values left of the 'pivot' are smaller and to the right are greater from the pivot. And consider

C++ Code Calculate Power of any Number -
For calculating the power of any number user have four possibilities to input values. Sample code only work for when we input +ve power, +ve 'base value', -ve base value. It is not work

C++ Simple Calculator Code for Beginners -
Write a simple C++ program which have four different functions for "basic operations" like addition, subtraction, division, multiplication. It should be menu based asking user to enter

Converting Lowercase String to Uppercase -
C program 'Converting string' from lowercase to uppercase string using loop. Internally in C language every characters are represented as an integer value known as ASCII value. Where

C++ Direct Recursion vs Indirect recursion -
Direct Recursion: When function calls itself, it is called "Direct recursion". Indirect recursion: When function calls "another function" & that function calls the calling function, then this is

C++ Find Closest Pair of Points in an Array -
Sort array of points according to X coordinate and Y coordinate. Find the distance between two points. And return the 'smallest distance' between 2 points. Find the 'distance' beween

Counts Numbers of Vowels & Consonants -
C program to Count total number of Vowel or Consonant in a string using switch case. Input String from user, store it in some variable say 'str'. Initialize 2 other variables to store vowel

Construct an Expression Tree For a Given -
Program, using recursion, evaluates a Prefix Expression in an "Expression Tree". A binary expression tree is a specific application of a 'binary tree' to evaluate certain expressions.