#include<graphics.h> #include<stdio.h> #include<conio.h> #include<math.h>
int main() { int x=120,y=115,bcolor,fcolor; int xmin=100,ymin=100,xmax=150,ymax=120; void boundaryFill4(int x,int y, int fill,int boundary); int gdriver = DETECT, gmode; clrscr(); clrscr(); initgraph(&gdriver, &gmode, "c:\\tc\\bgi"); setcolor(3); rectangle(xmin, ymin, xmax, ymax); boundaryFill4(x,y,4,3); getch(); closegraph(); return 0; } void boundaryFill4(int x,int y, int fill,int boundary) { int current; current=getpixel(x,y); if((current != boundary) && (current != fill)) { setcolor(fill); putpixel(x,y,fill); boundaryFill4(x+1,y,4,3); boundaryFill4(x-1,y,4,3); boundaryFill4(x,y+1,4,3); boundaryFill4(x,y-1,4,3); } }