日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

c语言 画函数,c语言绘制函数曲线

發布時間:2025/3/15 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 c语言 画函数,c语言绘制函数曲线 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

該樓層疑似違規已被系統折疊?隱藏此樓查看此樓

我這種方法為什么圖形只能顯示一下就不見了,這是為什么?能不能用在雙曲線上??能的話改哪里??

#include#includefloat a,b,c,xmin,xmax,max; void menu(){printf("\n*****welcome*****\n");

printf("\n 1.input coefficient");

printf("\n 2.input extent");

printf("\n 3.draw function curve");

printf("\n 4.quit");

printf("\n*****************\n");}

void fun1()

{ printf("input a,b,c\n");

scanf("%f,%f,%f",&a,&b,&c);

}void fun2()

{ printf("input xmin,xmax\n"); scanf("%f,%f",&xmin,&xmax);}

void funmax()

{ float m,n; if(xmin<0) m=-xmin; else m=xmin; if(xmax<0) n=-xmax; else n=xmax; if(m>=n) max=m; else max=n;}

float funx(float max_x)

{ return(max_x/2/max);}float funy(float max_y)

{float d; d=max_y/2/(a*max*max+b*max+c); if(d>0.6) d=0.6; if(d<0.0026) d=0.0026; return(d);}

void fun3()

{ int max_x,max_y; int graphdriver=DETECT,graphmode;

float x1,y1,x2,y2,x,coe_x,coe_y; initgraph(&graphdriver,&graphmode,"");

cleardevice(); max_x=getmaxx(); max_y=getmaxy();

funmax();

coe_x=funx(max_x); coe_y=funy(max_y); line(0,240,640,240); line(320,0,320,480); line(640,240,635,235); line(640,240,635,245); line(320,0,315,5); line(320,0,325,5); outtextxy(320,240,"(0,0)");

outtextxy(620,240,"x"); outtextxy(320,10,"y");

x1=max_x/2+xmin*coe_x,y1=max_y/2-(a*xmin*coe_x*xmin*coe_x+b*xmin*coe_x+c)*coe_y;

moveto((int)x1,(int)y1); for(x=xmin*coe_x;x<=xmax*coe_x;x++)

{ x2=max_x/2+x,y2=max_y/2-(a*x*x+b*x+c)*coe_y;

lineto((int)x2,(int)y2); }void getch();closegraph(); }

void main()

{ int n; menu(); while(1)

{ scanf("%d",&n); switch(n)

{ case 1:fun1();break;

case 2:fun2();break;

case 3:fun3();break;

case 4:exit(0);

default:printf("\n error \n"); } }}

總結

以上是生活随笔為你收集整理的c语言 画函数,c语言绘制函数曲线的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。