Program-: Title
Program-: Title
Title: - Write C++ program to draw a concave polygon and fill it with desired color using fill
algorithm.
Roll No:-
Class:-SE Computer
Date:-
****************************************************************************/
Program-
#include<graphics.h>
#include<iostream>
#include<stdlib.h>
int main()
{
int x1,y1,x2,y2,x3,y3,xavg,yavg;
int gdriver = DETECT,gmode;
initgraph(&gdriver,&gmode,NULL);
cout << " \n\t Enter the points of triangle";
setcolor(1);
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
xavg = (int)(x1+x2+x3)/3;
yavg = (int)(y1+y2+y3)/3;
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
ffill(xavg,yavg,BLACK,RED);
getch();
return 0;
}
/*Output:-