# C++ Programming Code Examples

## C++ > Beginners Lab Assignments Code Examples

### Encapsulation is a process of combining data members and functions in a single unit called class.

C programming Open and Copy Functions -
Open a source file. If there is an error giving message: Cannot open source file. Open destination file. If there is error give message: Cannot open destination file. If file won't

Checks Given Graph is Strongly Connected -
If there exists "Multiple Strongly Connected" component, graph is not strongly connected, it is otherwise. Implementation of Kosaraju's Algorithm to "Print all SCCs". Fills Stack with

C++ Swap Two Numbers Using 3. Variable -
Swap numbers means exchange the values of two variables with each other. Variable num1 contains 20 and num2 contains 40 after swap there values num1 contains 40 num2 contains

Find sum of Even Numbers in given Range -
Input upper limit to find sum of even number. Store it in a variable say N. Initialize another variable to store sum with 0 say sum = 0. To find sum of even numbers we need to iterate

Learn Bitwise Operators in C++ Language -
in C++, "bitwise operators" are similar to the Logic operators, but they perform the same logical operations on bits. All data in memory is represented in the "binary form". Variables

Convert Binary Code of a Number into its -
C Programming Language code to convert binary code of a number into its equivalent gray's code without using recursion. Gray is also represented using 0s and 1s. Speciality

Types of Loops in The C++ Programming -
While Loop: While a given Expression is true it "Repeats the Statement" in the loop body. Before executing the Loop Body it tests the condition for True or False. Do...While Loop:

C++ Programs Finds kth Smallest Element -
"Partitioning the array" on the basis of values at high as pivot value. Swapping value at high and at the index obtained. Partitioning array using last element as a pivot. And recursively