Saturday, 5 January 2019

BLINKING HEART PATTERN.



This Pattern is created with the help of looping concept
this pattern is just a combination of triangle patterns 


SOURCE CODE:

#include<iostream.h>
#include<conio.h>
void main()
{
    int i, j, n;
    clrscr();
    cout<<"Enter the Length : ";
    cin>>n;
    for(i=n/2; i<=n; i+=2)
    {
for(j=1; j<n-i; j+=2)
{
    cout<<" ";
}

for(j=1; j<=i; j++)
{
    textcolor(WHITE+BLINK);
    cprintf("*");
}

for(j=1; j<=n-i; j++)
{
    cout<<" ";
}

for(j=1; j<=i; j++)
{
    textcolor(WHITE+BLINK);
    cprintf("*");
}

cout<<"\n";
    }

    for(i=n; i>=1; i--)
    {
for(j=i; j<n; j++)
{
    cout<<" ";
}

for(j=1; j<=(i*2)-1; j++)
{
    textcolor(WHITE+BLINK);
    cprintf("*");
}

cout<<"\n";
    }
   getch();
}

SCREEN SHOT


No comments:

Post a Comment