# C++ Programming Code Examples

## C++ > Strings Code Examples

### Program to Implement Knuth-Morris-Pratt Algorithm (KMP)

C++ Matrix Addition Operation of Adding -
Two dimensional array in C++, represented in the form of rows and columns, also suitable with matrix. For multi dimensional array, the element with indices i,j would have "address"

C Programming coding Calendar example -
This is because a leap year does not strictly fall on every fourth year. If a year is divisible by 4, then it is a leap year, but if that year is divisible by 100, then it is not a leap year.

Program to Implement strpbrk() Function -
Locates "first occurrence" in string string1 of any character in string string2, If a character from string string2 is found, a pointer to the character in string 'string1' is returned, if not

Swapping Two Numbers Without Variable -
Imagine we have two number 1 and 2 stored in x and j respectively now. If we add x and j (1 + 2) and store it to x then x will become 3 and j is still 2. We subtract j (2) from new value of

C++ Program Finds Factorial of A Number -
The factorial of a positive integer n is equal to 1*2*3*...n. In program, user enters a positive integer. Then the "factorial" of that number is "computed and displayed" in the screen. Here

C++ Reversing a Sentence with Recursion -
This C++ program takes a sentence from user and "Reverses" that sentence using recursion. This sample doesn't 'use string' to reverse the sentence or store the sentence. User is asked

Find the Maximum Size Clique in a Graph -
This is a C++ Program to find the 'cliques' of size k in a a graph. An "Undirected Graph" is formed by a finite set of vertices and a set of unordered pairs of vertices, which are called

C Implement Priority Queue to Add Delete -
Add the elements into the queue according to the order (ascending descending). Delete the elements. Function to create an empty priority queue. Function to insert value into