Program to Draw Hollow diamond Shape in C++

Wap in C++ to Draw hollow Diamond shape in C++

Patterns and shapes C++


 

For other triangle and diamonds shapes see –> Patterns and Shapes in C++

 PROGRAM:

[adinserter block=”1″]

Download: hollowdiamondshape.cpp

OUTPUT:


 

Find factorial using recursion in C++

Here we will write a C++ program to find factorial using recursion, first we will understand what are factorials of a number and how to find out the factorials of a number.

Lets start with what is factorial.

What is Factorial of a number:

The factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example,

Factorial of 5,   5!= 5 x 4 x 3 x 2 x 1 = 120

Now we will write a program to find factorial using recursion in C++.

 

C++ Program to find factorial using recursion:

 

OUTPUT:

find factorial using recursion in C++

Simple program to print right triangle shape in C++

A very simple program to print right triangle shape in C++.

PROGRAM:

 

OUTPUT:

Program to implement Linear Search C++

Here we will write a program to implement Linear Search C++ programming language, so first lets start with what is linear search and how to write a program to implement linear search in C++.

 

What is Linear Search:

Linear search or sequential search is a method for finding a target value within a list. It sequentially checks each element of the list for the target value until a match is found or until all the elements have been searched

Linear search runs in at worst linear time and makes at most n comparisons, where n is the length of the list. the average time it takes is n/2, where n is the number of elements in the list/series/sequence.

Now lets write the C++ code to implement Linear search:

Performing Linear Search C++ Code:

PROGRAM:

Program to find reverse number in C++

Write a Program to find reverse number in C++

PROGRAM:

 

OUTPUT:

Program to display current Date and Time C++

To show current Date and Time in a program just use “localtime()” function.

Calculation of day, month and year is explained.

PROGRAM: