TEAM CODING-BCA

C Program for Drawing a Rectangle and Color it using Standard Library Function

C Program for Drawing a Rectangle and Color it Using Standard Library Function:

#include<stdio.h>
#include<conio.h>
#include<graphics.h>

void main()
{
int x1,y1,x2,y2;
int gd,gm;
detectgraph(&gd,&gm);
initgraph(&gd,&gm,"C:\\TurboC3\\BGI");
printf("\n Enter the co-ordinates of 1st point:");
scanf("%d%d",&x1,&y1);
printf("\n Enter the co-ordinates of 2nd point:");
scanf("%d%d",&x2,&y2);
setcolor(RED);
rectangle(x1,y1,x2,y2);
setfillstyle(SOLID_FILL,BLUE);
floodfill(x1+1,y1+1,RED);
getch();
closegraph();
}

                                     
Output

No comments:

Post a Comment