C程序:编写在屏幕上画出正弦曲线的函数

2024-12-26 16:31:07
推荐回答(1个)
回答1:

#include
#include
main(){
double y;
int x,m,i;
printf("y=sin(x) [0for(y=1;y>=-1;y-=0.1){
if(y>=0){
m=asin(y)*10;
for(x=1;xprintf("*",m);
for(;x<31-m;x++)printf(" ");
printf("*\n");}
else{
m=-1*asin(y)*10;
for(i=0;i<32;i++)printf(" ");
for(x=1;xprintf("*",m);
for(;x<31-m;x++)printf(" ");
printf("*\n",m);
}
}
}