#include "conio.h"
#include "math.h"
#include "graphics.h"
#include<stdio.h>
int main()
{
FILE *fp;
int x=100;
int y=239;
int j,h;
float m;
int driver,mode;
driver=VGA;
mode=VGAHI;
initgraph(&driver,&mode,"");
setbkcolor(BLACK);
setcolor(BLUE);
line(60,130,60,340);
line(20,239,600,239);
gotoxy(10,5);
printf("sin(3.14159/180*j*3)");
gotoxy(45,5);
printf("from linlin");
gotoxy(6,9);
printf("1");
gotoxy(6,15);
printf("0");
gotoxy(5,21);
printf("-1");
if((fp=fopen("sin.dat","w"))==NULL)
{
printf("cannot open file1.");
exit(1);
}
for(j=0;j<500;j++)
{
m=sin(3.14159/180*j*3);
h=y-(int)(m*100);
putpixel(x+j-40,h,WHITE);
fprintf(fp,"m=%f,h=%d",m,h);
gotoxy(10,7);
printf("m=%f",m);
gotoxy(25,7);
printf("h=%d",h);
delay(5000);
}
gotoxy(2,25);
printf("please input the j(200):(if you input -1,you will back to program.)\n j=");
scanf("%d",&j);
getch();
closegraph();
return 0;
}