Sunday, September 12, 2024

Drawing Line in Graphics Mode : Line Function

Program :
#include<graphics.h>
#include<stdio.h>
int main(void)
{
   int gdriver = DETECT,gmode;
   int x1=200, y1=200;
   int x2=300, y2=300;
   initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
   line(x1,y1,x2,y2);
   closegraph();
}

Explanation :
line(x1,y1,x2,y2);
  • Line Function Draws Line From (x1,y1) to (x2,y2) .
Syntax :
line(x1,y1,x2,y2);
ParameterExplanation
x1X Co-ordinate of First Point
y1Y Co-ordinate of First Point
x2X Co-ordinate of Second Point
y2Y Co-ordinate of Second Point

0 comments:

Post a Comment

Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email