Computer Graphics in C,C++

Tuesday, 6 January 2009

Function to draw the axis on the screen

#include"stdio.h"
#include"graphics.h"
#include"conio.h"
#include"math.h"
#include"stdlib.h>"
void main()
{

int I=DETECT,M,g;/*/

void xyaxis()
{
int h,k,y1=0,y2,x1=20,x2,i;
float r,x,y,t;
char s[20];


line(280,0,280,480);
line(0,240,560,240);
i=12;
while(y1<480)
{

outtextxy(266,y1-2,itoa(i,s,10));
i--;
y2=y1;
line(275,y1,285,y2);
y1=y1+20;

}
i=-13;
while(x1<560)
{
outtextxy(x1-5,225,itoa(i,s,10));
i++;
x2=x1;
line(x1,235,x2,245);
x1=x1+20;
}
getch();

}

No comments:

Post a Comment