//Program to Draw Line on axes
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm,midx,midy,i;
initgraph(&gd,&gm,"C:\\TurboC3\\BGI");
midx=getmaxx()/2; midy=getmaxy()/2;
setcolor(YELLOW);
line(midx-200,midy,midx+200,midy);
line(midx,midy-200,midx,midy+200);
outtextxy(midx+198,midy-3,"> X-AXIS");
outtextxy(midx-200,midy-3,"<");
outtextxy(midx-3,midy-200,"^ Y-AXIS");
outtextxy(midx-40,midy+8,"(0,0)");
circle(midx,midy,3);
setcolor(WHITE);
line(midx+70,midy-50,midx-100,midy-180);
circle(midx+70,midy-50,5);
circle(midx-100,midy-180,5);
outtextxy(midx+80,midy-53,"(70,50)");
outtextxy(midx-190,midy-182,"(-100,180)");
setcolor(GREEN);
setlinestyle(1,4,1);
line(midx,midy-50,midx+70,midy-50);
line(midx+70,midy,midx+70,midy-50);
line(midx-100,midy,midx-100,midy-180);
line(midx-100,midy-180,midx,midy-180);
outtextxy(midx+25,midy+10,"70");
outtextxy(midx+5,midy-30,"50");
outtextxy(midx-70,midy+10,"100");
outtextxy(midx-28,midy-100,"180");
setcolor(WHITE);
for(i=-180;i<=180;i=i+10)
{
line(midx+i,midy-4,midx+i,midy+4);
line(midx-4,midy+i,midx+4,midy+i);
}
getch();
closegraph();
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.