-moz-user-select:none; -webkit-user-select:none; -khtml-user-select:none; -ms-user-select:none; user-select:none;

Sunday 3 May 2015

Making a diamond in C++

Hello and Asalam o Alikum. I hope you all are fine by the grace of Allah Almighty.

Today I am here with a source code of making a diamond in C++.

So, don't be afraid !!! Making a diamond is not a difficult task anymore !!!

I will use 6 loops for this purpose. The division of these loops are as below:

3 loops for pyramid.

3 loops for inverted pyramid.

so, it means that

Diamond=pyramid+inverted pyramid. If you know how to make a pyramid and inverted pyramid,

you can easily make a diamond.

So,below is the source code of this program.

Source code


Output


How the program works?

The first 3 loops in the source code are used for pyramid and last 3 loops are used for inverted pyramid(the logic of making a pyramid is already described in my blog).


No comments:

Post a Comment