fork download
  1. #include<iostream>
  2. #include<graphics.h>
  3. void boundaryFill(int x,int y,int f_col,int b_col) {
  4.  
  5. if(getpixel(x,y)!=b_col && getpixel(x,y)!=f_col) {
  6.  
  7. putpixel(x,y,f_col);
  8.  
  9. boundaryFill(x+1,y,f_col,b_col);
  10.  
  11. boundaryFill(x-1,y,f_col,b_col);
  12.  
  13. boundaryFill(x,y+1,f_col,b_col);
  14.  
  15. boundaryFill(x,y-1,f_col,b_col);
  16. }
  17. }
  18. int main() {
  19. printf("Name: Raghuraj");
  20. printf(" (0701CS201052)");
  21.  
  22. initwindow(800,400);
  23.  
  24. rectangle(100, 150, 400, 300);
  25.  
  26. rectangle(400,260,500,290);
  27. arc(400,260,0,90,100);
  28. line(400,260,500,260);
  29.  
  30. circle(150, 320, 20);
  31.  
  32. circle(350, 320, 20);
  33.  
  34. boundaryFill(250, 210, RED, WHITE);
  35.  
  36. boundaryFill(351, 320, DARKGRAY, WHITE);
  37. boundaryFill(151,320,DARKGRAY,WHITE);
  38. boundaryFill(401,240,CYAN,WHITE);
  39. boundaryFill(401,261,BLUE,WHITE);
  40.  
  41. closegraph();
  42.  
  43. return 0;
  44. }
Success #stdin #stdout 0.03s 25352KB
stdin
Standard input is empty
stdout
#include<iostream>
#include<graphics.h>
void boundaryFill(int x,int y,int f_col,int b_col) {
 
if(getpixel(x,y)!=b_col && getpixel(x,y)!=f_col) {
 
putpixel(x,y,f_col);
 
boundaryFill(x+1,y,f_col,b_col);
 
boundaryFill(x-1,y,f_col,b_col);
 
boundaryFill(x,y+1,f_col,b_col);
 
boundaryFill(x,y-1,f_col,b_col);
 }
}
int main() {
printf("Name: Raghuraj");
printf(" (0701CS201052)");
 
initwindow(800,400);
 
rectangle(100, 150, 400, 300);
 
rectangle(400,260,500,290);
arc(400,260,0,90,100);
line(400,260,500,260);
 
circle(150, 320, 20);
 
circle(350, 320, 20);
 
boundaryFill(250, 210, RED, WHITE); 
 
boundaryFill(351, 320, DARKGRAY, WHITE); 
boundaryFill(151,320,DARKGRAY,WHITE);
boundaryFill(401,240,CYAN,WHITE);
boundaryFill(401,261,BLUE,WHITE); 
 
closegraph();
 
return 0; 
}