# C++ Programming Code Examples

## C++ > File Operations Code Examples

### Read & Write File Operation (Convert lowercase to uppercase) Using C++

Program Code Find Factorial of a Number -
Program to input a number and calculate its factorial using for loop. Factorial of a number n is product of all positive integers less than or equal to n. It is denoted as n!. ex. 5! = 120

Combinations Using Matrix Multiplication -
A C++ function to find the factorial of a given number using matrix multiplication method. Assigning numbers from "1 to n" to the super diagonal indexes of the matrix and assigning

Exception Handling Multiple Catch in C++ -
In C++ code, 'Declare and define' the function test(). Within the try block check whether the value is 'greater than zero' or not. If the value greater than zero 'throw the value' and catch

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

Code find sum of main diagonal elements -
Read elements in a matrix and find the sum of main diagonal (major diagonal) elements of matrix. Find sum of all elements of main diagonal of a matrix. Input elements in the

The C++ Break Statement and Switch Case -
In C++ program, we have the variable i inside "Switch Braces", which means whatever the value of variable i is, the 'corresponding' case block gets executed. We have passed integer

C++ Checks if an Undirected Graph is Tree -
C++ Program to check whether an undirected 'graph is tree' or not. Graph is tree if it doesn't contain cycles. A recursive function that uses visited[] & parent to detect cycle in subgraph

C Program Code Write a Sentence to a File -
Program stores a sentence entered by user in a file. After termination of this program, you can see a text file program.txt created in the same location where this program is located.