# C++ Programming Code Examples

## C++ > If Else and Switch Case Code Examples

### Check if an integer is odd or even In C++

Lets Learn String Functions in C Language -
Find the "Length of str1". Increment count till we reach the Terminating character. Find the "Length of str2". Check that we have enough 'space' for both strings. Copy 2. string to end

Code Extract Last Two Gigits of the year -
This c language program takes any year as input and prints its last two digits. Take any year as input. Divide the input by 100 and obtain its remainder. The remainder got is

2d example insertion sort [linked list] in C -
C program code to 2d example insertion sort [linked list]. Insert a node directly at the right place in the linked list. Insert some numbers into the linked list. Print the list. Free the list

C++ Basic Operation Addition Subtraction -
"Addition(+)" of 2 vectors. "Subtraction(-)" of 2 vectors. "Multiplication" of vector with the scalar. "Cross" product of 2 vectors. Scalar(or dot) product of 2 vectors. Negative of vectors

Strrchr searches the string in reverse order -
'StrrChr' is similar to the function 'StrChr', the only difference is that it searches the string in "Reverse Order", would have understood why we have extra r in 'strrchr', yes you guessed it

We shall Determine & Print if the value is -
This Code is very simple and a good example of using conditional statement (if-else) in an iteration (i.e. for loop). We shall initiate a for loop having some finite iterations and check

Program Convert Binary Decimal Number -
To improve "readability of program" make a separate function and function should return the "resultant number". In main function user enters input number. Calls the function, pass

C++ Find kth Largest Element in Sequence -
A Function to build max heap from the initial array by checking all non-leaf node to satisfy the condition. And build "max-heap" k times, extract the 'maximum' and store it in the end