回复 3楼 雨夜星光
谢谢哦,不过运行的结果不对啊,我自己的,不过没有循环,每次都要自己输入数据,该怎么修改呢??
#include <stdio.h>
#include <math.h>
#define PAI 3.1415962
void main()
{
int i,h;
int a=100;//空袋宽度
int c=45;//后倾角角度值
//double high,u,fai,x,y,z,a,b,c,d;
double
h1,h1_denominator1,h1_denominator2,h1_least,r,e,fai,u,temp;
double
high,high_denominator,high_denominator1,high_denominator2,high_denominator3,high__least;
for(i=1;i<=11;i++)
{
printf("请输入fai的值及其对应的u的值:(以空格键分隔)\n");
scanf("%lf %lf",&fai,&u);
r=a/PAI;
//r=a/3.14;
h1_denominator1=PAI/4*a*cos(c*PAI/180)+r*cos(c*PAI/180);
temp=h1_denominator1*h1_denominator1+4*(1+sin(c*PAI/180))*pow(a,2);
h1_denominator2=sqrt(temp);
h1_least=2*(1+sin(c*PAI/180));
h1=(h1_denominator1+h1_denominator2)/h1_least;
h=((int)h1/10)*10;
if(h<h1)
h=h+10;
else
h=h+0;
e=(0.5*pow(a,2)-2*pow(r,2))/(h*(1+sin(c*PAI/180))-pow(a,2)/h-2*r*cos(c*PAI/180));
high_denominator1=e*a/h*(u-r*sin(fai*PAI/180));
high_denominator2=r*(e*cos(c*PAI/180)-r)*(1-cos(fai*PAI/180));
high_denominator3=0.5*pow(u,2);
high__least=e*(1+sin(c*PAI/180));
high_denominator=high_denominator1+high_denominator2+high_denominator3;
high=h-high_denominator/high__least;
printf("所对应的曲线高为:\n");
printf("high=%lf\n",high);
}
}