 C++ Programming Code Examples

C++ > Beginners Lab Assignments Code Examples

Similar to friend class, this function can access the private and protected members of another class.

Program Solve The 0-1 Knapsack Problem - C++ Program to solve 0-1 'knapsack problem'. The 'Knapsack' problem or Rucksack problem is a problem in "Combinatorial Optimization": Given a Set of items, each with a mass, value,

Program to Display Alphabets using ASCII - Printing alphabets in C Programming, is little trick. If you are good at basic data types and literals then this is easy for you. Internally C represent every character using ASCII Code.

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 Nth Fibonacci Numbers using Recursion - Prints the Fibonacci of a given number using recursion. In fibonacci series, each number is the sum of the two preceding numbers. 0, 1, 1, 2, 3, 5, 8, ... The following program returns

C++ Program Find the Area of a Triangle - Enter size of each sides of 'triangle'. To find the area of triangle in which values of three sides are given we can use Heron's formula. To apply "Heron's formula" there should be

C++ Program use Linear Search Technique - First ask to enter the array size then it will ask to enter the array elements, then it will finally ask to enter a number to be search in array to check whether it is present in the array or not

C++ Switch Statement Control Statement - "Switch statement" is multi-way decision that tests whether an expression 'matches' one of a number of "constant integer", and branches accordingly. 'Switch statement' that allows us

C Check Whether a number is Even or Odd - C Program code to Check Whether a number is even or odd using if else. A number exactly divisible by 2 leaving no remainder, is known as even number. Any number modulo divided