#includeint main() { int gd = DETECT, gm; initgraph(&gd, &gm, ""); setcolor(YELLOW); setfillstyle(SOLID_FILL, YELLOW); fillrect(50, 50, 150,150); getch(); closegraph(); return 0; }
#includeIn this example, a green filled rectangle is drawn on the screen with the top left corner coordinates of (200, 150) and bottom right corner coordinates of (300, 200). Both of these examples use the graphics.h library, specifically the fillRect function, to draw filled rectangles on the screen with specified colors.int main() { int gd = DETECT, gm; initgraph(&gd, &gm, ""); setcolor(WHITE); setfillstyle(SOLID_FILL, GREEN); fillrect(200, 150, 300, 200); getch(); closegraph(); return 0; }