c作图-正弦函数图像
#include<graphics.h>
#include<math.h>
int main()
{
int gmode,gdriver=DETECT;
double x1,y1,x2,y2;
initgraph(&gdriver,&gmode,"");
cleardevice();
setbkcolor(WHITE);
setcolor(BLACK);
line(0,240,600,240);
line(570,220,600,240);
line(570,260,600,240);
line(320,0,320,480);
line(300,35,320,0);
line(340,35,320,0);
for(x2=100;x2<=540;x2+=0.001)
{
y2=-sin(((x2+40)-360)/70)*100+240;
if(x2!=100)
{
setcolor(RED);
//line(x1,y1,x2,y2);
// putpixel(x2,y2,RED);
}
x1=x2;
y1=y2;
}
getch();
return 0;
}
本文来自博客园,作者:左手边五十米,转载请注明原文链接:https://www.cnblogs.com/moomcake/p/8796609.html