# C++ Programming Code Examples

## C++ > Beginners Lab Assignments Code Examples

### main() Function of C++

Writing String to a File in C Programming -
Str - str represents the array, in which string is stored. Fpw - FILE pointer to the output file, in which record needs to be written and opening the file FILEW.TXT in "w" mode for

C code to Check and Read Identity Matrix -
C program to read elements in a matrix and check whether matrix is an Identity matrix or not. Identity matrix is a special square matrix whose main diagonal elements is equal to 1

Find Maximum Numbers of Edge Disjoint -
C++ program displays the maximum number of edge disjoint paths present between two vertices. 'Maximum number' of edge disjoint paths refers to the maximum flow or shortest

C Number of Occurrences of an Element in -
Code Count the number of Occurrences of an element in the linked list using recursion. This C Program uses recursive function & finds the occurrence for an element in an Unsorted list.

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

Binary Search Tree by Recursive Traversals -
Function to insert a node in the tree. Inorder recursive & nonrecursive traversal. 'Preorder' recursive & nonrecursive traversal. 'Postrder' recursive traversal. Postorder non recursive

How to pass an entire array to a function -
Pointer var1 is pointing to the first element of the array and the var2 is the size of the array. In the loop we are incrementing pointer so that it points to the next element of the array

Program Convert Hexadecimal to Decimal -
To convert a number from "hexadecimal" into equivalent decimal format "in C++", enter the hexadecimal number to convert it to decimal to display the equivalent value in "decimal" as