怎样用c语言画正弦函数

2024-11-21 15:42:24
推荐回答(1个)
回答1:

我画了半个正弦函数,其余的你可以照着画,欢迎讨论,
#include "stdio.h"
#include "conio.h"
#include "math.h"
#include "graphics.h"

void main()
{
int driver,mode,i;
driver=DETECT;
mode=0;
initgraph(&driver,&mode,"");
setcolor(15);
for(i=0;i<360;i++)

line(i,200*sin(i*3.14/360),i+1,200*sin((i+1)*3.14/360));

getch();
restorecrtmode();
}