#include <graphics.h>
main()
{ float m;
printf("the m is "); //输入直线的斜率m
scanf("%f",&m);
if(abs(m)<=1)
{
int x;
float y;
int driver=DETECT,mode;
initgraph(&driver,&mode,"c:\WINLibTC");
y=10*m+30;
for(x=10;x<=300;x++)
{
y=y+m;
putpixel(x,y,4);
}
getch();
closegraph();
}
else
{
int y;
float x;
int driver=DETECT,mode;
initgraph(&driver,&mode,"c\WINLibTC");
for(y=10;y<=300;y++)
{
x=x+1/m;
putpixel(x,y,4);
}
getch();
closegraph();
}
}