Print ALLAH in Heart Shape in C++

Drawing Different Shapes is an interesting task and it helps in learning nested loops too. But Drawing boring and most used shapes like triangles etc has made this a boring task for students… I have drawn different and interesting shapes like this one to learn logic building and to get grip on my programming concepts. I hope this will be interesting for you too.
I have used char(3) in this program that is equal to heart ♥ . So this shape is basically drawn using Hearts.. It’s Heart of Hearts with Inside written ALLAH.

Code:

//print heart of hearts in Cpp using for loops
#include<iostream>
using namespace std;
int main()
{
int i=3,j,k,n=10;
char h=i;

cout<<endl<<endl;
for(i=3;i<=n;i++)
{
for(j=n;j>=i;j--)
cout<<" ";
for(k=1;k<=(2*i-1);k++)
cout<<h;
for(j=2*n;j>=(2*i+1);j--)
cout<<" ";
cout<<" ";
for(k=1;k<=(2*i-1);k++)
cout<<h;
cout<<endl;
}
for(i=(2*n-1);i>18;i--)
{
for(j=i;j<=2*n;j++)
cout<<" ";
for(k=1;k<=(2*i-1);k++)
cout<<h;
cout<<endl;
}
	cout<<"   "<<h<<h<<h<<h<<h<<h<<h<<"          ^          "<<h<<h<<h<<h<<h<<h<<h<<endl;
	cout<<"   "<<" "<<h<<h<<h<<h<<h<<h<<"        (_|_)        "<<h<<h<<h<<h<<h<<h<<endl;
	cout<<"   "<<"  "<<h<<h<<h<<h<<h<<"                     " <<h<<h<<h<<h<<h<<endl;
	cout<<"    "<<"  "<<h<<h<<h<<h<<"      /|  |  | |     " <<h<<h<<h<<h<<endl;
	cout<<"     "<<"  "<<h<<h<<h<<"    |/ |  |  | |     "<<h<<h<<h<<endl;
	cout<<"      "<<"  "<<h<<h<< "       |__|__| |     " <<h<<h<<endl;
	cout<<"       "<<"  "<<h<<"                     "<<h<<endl;
int ii=i-7;
for(i=ii;i>=1;i--)
{
for(j=i;j<=2*n;j++)
cout<<" ";
for(k=1;k<=(2*i-1);k++)
cout<<h;
cout<<endl;
}
}

Output:



        ♥♥♥♥♥               ♥♥♥♥♥
       ♥♥♥♥♥♥♥             ♥♥♥♥♥♥♥
      ♥♥♥♥♥♥♥♥♥           ♥♥♥♥♥♥♥♥♥
     ♥♥♥♥♥♥♥♥♥♥♥         ♥♥♥♥♥♥♥♥♥♥♥
    ♥♥♥♥♥♥♥♥♥♥♥♥♥       ♥♥♥♥♥♥♥♥♥♥♥♥♥
   ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥     ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥   ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
 ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
   ♥♥♥♥♥♥♥          ^          ♥♥♥♥♥♥♥
    ♥♥♥♥♥♥        (_|_)        ♥♥♥♥♥♥
     ♥♥♥♥♥                     ♥♥♥♥♥
      ♥♥♥♥      /|  |  | |     ♥♥♥♥
       ♥♥♥    |/ |  |  | |     ♥♥♥
        ♥♥       |__|__| |     ♥♥
         ♥                     ♥
          ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
           ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
            ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
             ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
              ♥♥♥♥♥♥♥♥♥♥♥♥♥
               ♥♥♥♥♥♥♥♥♥♥♥
                ♥♥♥♥♥♥♥♥♥
                 ♥♥♥♥♥♥♥
                  ♥♥♥♥♥
                   ♥♥♥
                    ♥

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *