# C++ Programming Code Examples

## C++ > Pyramid Patterns Code Examples

### Program to print half pyramid using alphabets

C If a given Integer is Positive or Negative -
Take the integer which you want to check as input and store it in a variable number. Using if, else statements check whether the integer is Greater or Lesser than zero. If it is greater...

C Code to Illustrate the Concept of Unions -
C Define the union named number with two variables j1 and j2. Define the union variable x. Take the value of two variables using dot operator(i.e. x.j1, x.j2) as input. Print values

Checks Cycle in a Graph using Topological -
Displaying the "Topological Sort Method" of finding whether a given graph contains cycle or not using Kosaraju's Algorithm. Enter the source and destination. Cycles exist in graph.

C Program to generate nth Fibonacci term -
C Code Declare recursive function to find nth Fibonacci term. Assign a meaningful name to the function, say fibo(). The function accepts an integer hence update function declaration

Program Sample Displays Prime Numbers -
If a number passed to checkPrimeNumber() is a Prime Number, this function returns true, if not the Function returns false. If enters larger number first, 'code' will not work as intended.

C++ Language & Concatenate Two Strings -
Combined two strings means add both string with each other, perform this operation using 'library function' or without library function. If first string is 'john' and second string is porter

C++ Sorts Elements Lexicographical Order -
This program sorts the 10 strings (entered by the user) in Lexicographical order (dictionary order). This program takes 10 words from the user and sort them in 'Lexicographical Order'

C++ Codings Global Function Friend Class -
Similar to friend class, this 'C++ Function' can access the private and protected members of another class. A 'Global Function' can also be 'declared as friend' as shown in the C++ Code