# C++ Programming Code Examples

## C++ > Beginners Lab Assignments Code Examples

### Simple Queue Program in C++ Programming

C Diameter Circumference & Area of circle -
C Functions to find Diameter, Circumference and Area of circle. First assign a meaningful name to all the three functions. Say function to calculate diameter, circumference & area

C Programming Uses For Loop Statements -
For Loop in C. First initialization happens and the counter variable gets initialized. Second step the condition is checked, where counter variable is tested for the given condition, if...

Performs Binary Search on a Sorted Array -
Returns a pointer to the first member that matches *key. A null pointer is returned if not found. The array must be sorted in ascending order. The number of elements in the array is

Returns a String representation of Integer -
Converting an integer to a string with a fixed width. If the width is too small, the minimum width is assumed. Generate digit characters in reverse order. Shift the string to the right

C Programs Depth First Binary Tree Search -
C program, using recursion, performs a depth first search traversal. Depth-first search (DFS) is an algorithm for 'Traversing or Searching' a tree, 'tree structure' or graph. The concept of

Program Finds the Longest Path in a DAG -
Program to find longest path in DAG. Given a weighted directed acyclic graph and a source vertex s in it, find the longest distances from s to all other vertices in the given graph. Create

Code Find Second largest number in Array -
Code to find the largest and second largest element in an array. Step by step descriptive logic to find second largest element in array. Find second largest element of an array in C

Code Swap first and last digit of a number -
C program to input a number from user and swap first and last digit of the given number. Input number from user, find last digit, find total number of digit - 1, find first digit. How