用C语言编写程序: 在同一直角坐标系上输出以下两个方程图形。 y1=sinx, y2=x/3 其中,-π/2≤x≤π/2

如题所述

Turbo C 图形模式画图 π/2 取近似值1.57#include #include #include #define LEN 100 /*100个点表示长度1*/int main(){ int x; int y; int gdriver = DETECT; int gmode; initgraph(&gdriver,&gmode,"C:\\TC20\\BGI"); cleardevice(); setcolor(RED); line(0,240,640,240); line(320,0,320,480); setcolor(YELLOW); setlinestyle(1,0,1); line(0,40,640,40); line(0,140,640,140); line(0,340,640,340); line(0,440,640,440); line(20,0,20,480); line(120,0,120,480); line(220,0,220,480); line(420,0,420,480); line(520,0,520,480); line(620,0,620,480); for( x = 320 - 157; x { y = 240 - (int)(LEN * (x-320)/100.0/3); putpixel(x,y,WHITE); } for( x = 320 - 157; x { y = 240 - (int)(LEN * sin((x-320)/100.0)); putpixel(x,y,GREEN); } getch(); closegraph(); return 0;}效果图



温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-03-30
if(x>=&&x<=)
{
y1=;
y2=;
}
第2个回答  2011-03-31
也可以用MFC实现。。。。

相关了解……

你可能感兴趣的内容

大家正在搜

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网