用C语言编写程序: 在同一直角坐标系上输出以下两个方程图形。 y1=sinx, y2=x/3 其中,-π/2≤x≤π/2 20
2个回答
展开全部
//TC2.0下编译
#include "graphics.h"
#include "stdio.h"
#include "math.h"
main()
{int i,a,b,w=50,h=50;
float x,y1,y2;
clrscr();
detectgraph(&a,&b);
initgraph(&a,&b,"h:\tc2");
for(x=-3.14/2;x<=3.13/2;x=x+3.14/200)
{y1=-1*sin(x)*100+200;
y2=-1*x/3*100+200;
putpixel(x*50+200,y1,4);
putpixel(x*50+200,y2,4);
}
getchar();
closegraph();
}
#include "graphics.h"
#include "stdio.h"
#include "math.h"
main()
{int i,a,b,w=50,h=50;
float x,y1,y2;
clrscr();
detectgraph(&a,&b);
initgraph(&a,&b,"h:\tc2");
for(x=-3.14/2;x<=3.13/2;x=x+3.14/200)
{y1=-1*sin(x)*100+200;
y2=-1*x/3*100+200;
putpixel(x*50+200,y1,4);
putpixel(x*50+200,y2,4);
}
getchar();
closegraph();
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询