# C++ Programming Code Examples

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

### If-Else Statement - check even or odd

Check a Number can be Expressed as Sum -
Program to check whether a number can be expressed as sum of two prime numbers. To accomplish this task, "checkPrime()" function is created. The "checkPrime()" returns 1 if the

Decimal equivalent of input Hexadecimal -
Program to display the decimal equivalent of an input hexadecimal number (Hexadecimal to Decimal). How many digits in input? Digits of your i/p no. must not exceed entered limit

Generate All Subsets of a Given Set in the -
Print all combination of a given length from the given array. Return if the currLen is more than the "required length". If currLen is equal to required length then "Print the sequence".

C++ Sample code Linear Search Algorithm -
Linear search is method for searching a value within an array. It 'sequentially' checks one by one of the arrays for the 'target element' until 'match is found' or until all the elements have

C Program to Open, Read & Close the File -
C various file opening modes: File is opened using fopen() c function, while opening you can use any of the following mode as per the requirement. Mode "r": It is a read only mode,

Find Sum of First & Last digit of a number -
C program to input a number and find sum of first & last digit of the number using for loop. Input a number from user and store it in some variable say j. Find last digit of given number

C++ Finds Gets and Display the IP Address -
To get the IP address of your computer in c++ programming, use the function system() and place the command 'ipconfig' after providing the full path of 'System32' i.e., C:\\Windows\\

Overridings Non-Virtual Functions in C++ -
See that problem. Even though we have the parent class pointer pointing to the instance of child class, the parent class version of the function is invoked. You may thinking why I