Write A Program To Fill A Circle Using Flood Fill Algorithm | VCMIT

Fill A Circle Using Flood Fill Algorithm


INPUT

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void floodFill(int, int, int, int);
int midx=319, midy=239;
void main()
{
int gdriver=DETECT, gmode, x,y,r;
initgraph(&gdriver, &gmode, "C:\\TURBOCS3\\BGI");
cleardevice();
printf("Enter the Center of circle (X,Y) : ");
scanf("%d %d",&x,&y);
printf("Enter the Radius of circle R : ");
scanf("%d",&r);
circle(midx+x,midy-y,r);
getch();
floodFill(midx+x,midy-y,13,0);
getch();
closegraph();
}

void floodFill(int x, int y, int fill, int old)
{
if(getpixel(x,y) == old)
{
putpixel(x,y,fill);
delay(5);
floodFill(x+1,y,fill,old);
floodFill(x-1,y,fill,old);
floodFill(x,y+1,fill,old);
floodFill(x,y-1,fill,old);
}
}

OUTPUT


Disqus Comments
TheWaoFam. يتم التشغيل بواسطة Blogger.

إجمالي مرات مشاهدة الصفحة

بحث هذه المدونة الإلكترونية

  • ()

Random Posts

randomposts

Recent Posts

recentposts

Footer Link

Connected

Facebook

banner image

Most Recent

نموذج الاتصال

Categories

There are many variations of passages of Lorem Ipsum available.

About Me

Hi there, I’m Amanda – a girl love fashion and love to express herself with her own sense of style.

Trending