很有兴趣
那个左边的那条斜线怎么去掉啊,我又改了下
#include<conio.h>
#include<graphics.h>
#include<math.h>
#define pi 3.14159265
void DrawCoord();
void Drawstg();
void Drawsin();
void initgr(void)
{
int driver,mode;
driver=DETECT;
mode=0;
initgraph(&driver,&mode,"");
}
int main(void)
{
initgr();
DrawCoord();
Drawstg();
Drawsin();
getch();
closegraph();
return 0;
}
void DrawCoord() /*画坐标系*/
{
line(200,0,200,400); /*y轴*/
line(0,200,400,200); /*x轴*/
line(200,0,195,5); /*箭头*/
line(200,0,205,5);
line(400,200,395,195);
line(400,200,395,205);
outtextxy(180,10,"y"); /*标出y轴*/
outtextxy(380,180,"x"); /*标出x轴*/
outtextxy(210,210,"O");/*标出原点*/
}
void Drawstg()/*标出刻度尺*/
{
int x,y,i;
x=200,y=400;
for(i=0;i<400;i++)
{
line(x+5,y,x,y);
y-=10;
}
x=400,y=200;
for(i=0;i<400;i++)
{
line(x,y-5,x,y);
x-=10;
}
}
void Drawsin()/*画出sin函数*/
{
int x;
double y;
for(x=200;x<=(40*pi+200);x=(x+5))
{
y=(0-100*sin(0.05*(x-200)))+200;
lineto(x,y);
}
}