c语言课程设计作业,要求画曲线函数,语句不懂,求给详细注释代码如下
#include<math.h>
#include<stdlib.h>
#include<stdio.h>
intmain()
{
inti;
voiddraw1();
voiddraw2();
voiddraw3();
menu:
printf("youwanttokonwcosX,pleasepress1\n");
printf("youwanttokonwline,pleasepress2\n");
printf("youwanttokonwcosXandline,pleasepress3\n");
printf("youwanttoreturnpleasepress4\n");
scanf("%d",&i);
switch(i)
{
case1:draw1();break;
case2:draw2();break;
case3:draw3();break;
case4:exit(0);
}
gotomenu;
}
voiddraw1()
{
doubley;
inta2,b2,x,m,yy;
printf("请输入x的取值范围:");
scanf("%d~%d",&a2,&b2);
for(yy=0;yy<=20;yy++)
{
y=0.1*yy;
m=acos(1-y)*10;
for(x=a2;x<=b2;x++)
if(x==m||x==62-m)
printf("*");//
elseprintf("");
printf("\n");
}
#include<math.h>
#include<stdlib.h>
#include<stdio.h>
intmain()
{
inti;
voiddraw1();
voiddraw2();
voiddraw3();
menu:
printf("youwanttokonwcosX,pleasepress1\n");
printf("youwanttokonwline,pleasepress2\n");
printf("youwanttokonwcosXandline,pleasepress3\n");
printf("youwanttoreturnpleasepress4\n");
scanf("%d",&i);
switch(i)
{
case1:draw1();break;
case2:draw2();break;
case3:draw3();break;
case4:exit(0);
}
gotomenu;
}
voiddraw1()
{
doubley;
inta2,b2,x,m,yy;
printf("请输入x的取值范围:");
scanf("%d~%d",&a2,&b2);
for(yy=0;yy<=20;yy++)
{
y=0.1*yy;
m=acos(1-y)*10;
for(x=a2;x<=b2;x++)
if(x==m||x==62-m)
printf("*");//
elseprintf("");
printf("\n");
}