www.pudn.com > c.rar > JGSJ.C, change:1996-12-14,size:12966b


#include "stdio.h" 
#include "conio.h" 
#include "math.h" 
float A0,Ag,Agy,n,b,h,y1,y2,I0,a,ay,k1,k2,e0,M,N,Eh,Ih,l0,e,Oh,Oa,Ogy,OG; 
float g,egy,eg,vk1,vk2,x,Og,p,q,y; 
float biy,hiy; 
int i; 
/******************************Input function*****************************/ 
void Input() 
{ 
printf("Please input M,N,Ag,Agy,n,b,h,a,ay,Eh,l0,Oa,OG......\n"); 
printf("M=");scanf("%f",&M); 
printf("N=");scanf("%f",&N ); 
printf("Ag=");scanf("%f",&Ag); 
printf("Agy=");scanf("%f",&Agy); 
printf("n=");scanf("%f",&n); 
printf("b=");scanf("%f",&b); 
printf("h=");scanf("%f",&h); 
printf("a=");scanf("%f",&a); 
printf("ay=");scanf("%f",&ay); 
printf("Eh=");scanf("%f",&Eh); 
printf("l0=");scanf("%f",&l0); 
printf("Oa=");scanf("%f",&Oa); 
printf("OG=");scanf("%f",&OG); 
} 
/******************************Output function****************************/ 
void Output() 
{ 
if(Oh<=Oa&&Ogy<=OG) 
{printf("**********************************************\n"); 
printf("Oh=%ePa\n",Oh); 
printf("Ogy=%ePa\n",Ogy); 
printf("The result passed!\n"); 
printf("***********************************************\n"); 
} 
else if(Oh>Oa) 
{printf("Oh=%ePa\n",Oh); 
printf("Ogy=%ePa\n",Ogy); 
printf("Fault! Oh>Oa\n");} 
else 
{printf("**********************************************\n"); 
printf("Oh=%ePa\n",Oh); 
printf("Ogy=%ePa\n",Ogy); 
printf("Fault! Ogy>OG\n"); 
printf("***********************************************\n"); 
} 
} 
/******************************Output1 function***************************/ 
void Output1() 
{ 
if(Oh<=Oa&&Ogy<=OG&&Og<=OG) 
{printf("***********************************************\n"); 
printf("Oh=%ePa\n",Oh); 
printf("Ogy=%ePa\n",Ogy); 
printf("Og=%ePa\n",Og); 
printf("The result passed!\n"); 
printf( "***********************************************\n"); 
} 
else 
{printf("***********************************************\n"); 
printf("Oh=%ePa\n",Oh); 
printf("Ogy=%ePa\n",Ogy); 
printf("Og=%ePa\n",Og); 
printf("Fault! Possible Ogy>OG or Og>OG or Oh>Oa\n"); 
printf("************************************************\n");} 
} 
/******************************F(X,p1,p2)*********************************/ 
float F(X,p1,p2) 
float X,p1,p2; 
{float result; 
result=pow(X,3)+p1*X+p2; 
return(result); 
} 
/*****************************f(X,p1)************************************/ 
 
float f(X,p1) 
float X,p1; 
{float result1; 
result1=3.*X*X+p1; 
return(result1); 
} 
/****************************function qjz()*******************************/ 
float qjz() 
{ 
float N,m,Agy,b,h,Q,Oa,Oh; 
printf("Please input N,m,Agy,b,h,Q,Oa......\n"); 
printf("N="); 
scanf("%f",&N); 
printf("m="); 
scanf("%f",&m); 
printf("Agy="); 
scanf("%f",&Agy); 
printf("b="); 
scanf("%f",&b); 
printf("h="); 
scanf("%f",&h); 
printf("Q="); 
scanf("%f",&Q); 
printf("Oa="); 
scanf("%f",&Oa); 
Oh=N/(Q*(b*h+m*Agy)); 
if(Oh<=Oa) 
{printf("**********************************************\n"); 
printf("Oh=%ePa\n",Oh); 
printf("The result passed! Oh<Oa!\n"); 
printf("***********************************************\n"); 
} 
else if(Oh>Oa) 
{printf("**********************************************\n"); 
printf("Oh=%ePa\n",Oh); 
printf("Fault! Oh>Oa!\n"); 
printf("***********************************************\n"); 
} 
} 
/****************************function xjz()******************/ 
float xjz() 
{float N,m,my,Agy,Dhe,s,aj,Oa,Oh; 
printf("Please N,m,my,Agy,Dhe,s,aj,Oa......\n"); 
printf("N=");scanf("%f",&N); 
printf("m=");scanf("%f",&m); 
printf("my=");scanf("%f",&my); 
printf("Agy=");scanf("%f",&Agy); 
printf("Dhe=");scanf("%f",&Dhe); 
printf("s=");scanf("%f",&s); 
printf("aj=");scanf("%f",&aj); 
printf("Oa=");scanf("%f",&Oa); 
Oh=N/(3.1415*Dhe*Dhe/4.+m*Agy+2*my*3.1415*Dhe*aj/s); 
if(Oh<=Oa) 
{printf("**********************************************\n"); 
printf("Oh=%ePa\n",Oh); 
printf("The result passed! Oh<Oa!\n"); 
printf("***********************************************\n"); 
} 
if(Oh>Oa) 
{printf("**********************************************\n"); 
printf("Oh=%ePa\n",Oh); 
printf("Fault! Oh>Oa!\n"); 
printf("***********************************************\n"); 
} 
} 
/***************************function sxjx()*************************/ 
float sxjx() 
{ 
Input(); 
A0=b*h+n*(Ag+Agy); 
y1=(0.5*b*h*h+n*(Ag*(h-a)+Agy*ay))/(b*h+n*(Ag+Agy)); 
y2=h-y1; 
I0=b*(pow(y1,3)+pow(y2,3))/3+n*(Agy*pow((y1-ay),2)+Ag*pow((y2-a),2)); 
k1=I0/(A0*y2); 
k2=I0/(A0*y1); 
e0=M/N; 
Ih=b*pow(h,3)/12.; 
e=1./(1.-2.*N/((0.1/(0.2+e0/h)+0.16)*3.1415*3.1415*Eh*Ih/(l0*l0)))*e0+h/2-y2; 
if(e<=k1||e<=k2) 
{printf("This construction is little bias!\n"); 
Oh=N/A0+M*y1/I0; 
Ogy=n*(N/A0+M*(y1-ay)/I0); 
Output(); 
} 
else 
printf("This construction is large bias!\n"); 
g=e-h/2.; 
egy=e-h/2.+ay; 
eg=e+h/2.-a; 
p=6.*n*(Agy*egy+Ag*eg)/b-3.*g*g; 
q=-6.*n*(Agy*egy*egy+Ag*eg*eg)/b+2.*g*g*g; 
vk1=-F(3.*h/4.,p,q)/f(3.*h/4.,p);            /****at 3/4 length estimated**/ 
y=3.*h/4; 
vk2=-F((y+vk1),p,q)/f((y+vk1),p); 
y=3.*h/4.+vk1+vk2; 
x=y-g; 
Oh=N*e/((0.5*b*x*(h/2.-x/3.))+n*Agy*(x-ay)*(h/2.-ay)/x+\ 
n*Ag*(h-x-a)*(h/2.-a)/x); 
Ogy=n*Oh*(x-ay)/x; 
Og=n*Oh*(h-x-a)/x; 
Output1(); 
} 
/***************************T function*****************************/ 
float T() 
{ 
Input(); 
printf("Please input biy,hiy \n"); 
printf("biy=");scanf("%f",&biy); 
printf("hiy=");scanf("%f",&hiy); 
A0=b*h+hiy*(biy-b)+2*n*(Ag+Agy); 
y1=(0.5*b*h*h+hiy*(biy-b)*(h-0.5*hiy)+n*(Ag*a+Agy*(h-ay)))/(b*h+hiy*(biy-b)\ 
+n*(Ag+Agy)); 
y2=h-y1; 
I0=(biy*y2*y2*y2-(biy-b)*(y2-hiy)*(y2-hiy)*(y2-hiy)+b*y1*y1*y1)/3.\ 
+n*(Agy*(y2-ay)*(y2-ay)+Ag*(y1-a)*(y1-a)); 
k1=I0/(A0*y2); 
k2=I0/(A0*y1); 
e0=M/N; 
Ih=b*h*h*h/12.; 
e=1./(1.-2.*N/((0.1/(0.2+e0/h)+0.16)*3.1415*3.1415*Eh*Ih/(l0*l0)))*e0+h/2-y2; 
if(e<=k1||e<=k2) 
{printf("This construction is little bias!\n"); 
Oh=N/A0+M*y1/I0; 
Ogy=n*(N/A0+M*(y1-ay)/I0); 
Output(); 
} 
else 
printf("This construction is large bias!\n"); 
} 
/***************************I and xx function*****************************/ 
float I() 
{ 
float I0y; 
Input(); 
printf("Please input biy,hiy \n"); 
printf("biy=");scanf("%f",&biy); 
printf("hiy=");scanf("%f",&hiy); 
A0=b*h+2.*hiy*(biy-b)+n*(Ag+Agy); 
I0=(biy*h*h*h-(biy-b)*(h-2.*hiy)*(h-2.*hiy)*(h-2.*hiy))/12.+\ 
n*(Ag+Agy)*(0.5*h-a)*(0.5*h-a); 
y1=0.5*h; 
y2=y1; 
k1=I0/(A0*y2); 
k2=k1; 
e0=M/N; 
Ih=(biy*h*h*h-(biy-b)*(h-2*hiy)*(h-2*hiy)*(h-2*hiy))/12.; 
e=1./(1.-2.*N/((0.1/(0.2+e0/h)+0.16)*3.1415*3.1415*Eh*Ih/(l0*l0)))*e0+h/2.-y2; 
if(e<=k1||e<=k2) 
{printf("This construction is little bias!\n"); 
Oh=N/A0+M*y1/I0; 
Ogy=n*(N/A0+M*(y1-ay)/I0); 
Output(); 
} 
else 
printf("This construction is large bias!\n"); 
g=e-h/2.; 
egy=e-h/2.+ay; 
eg=e+h/2.-a; 
p=(3.*(biy-b)*((g+hiy)*(g+hiy)-g*g)+6.*n*(Ag*eg+Agy*egy))/b-3.*g*g; 
q=-(2.*(biy-b)*((g+hiy)*(g+hiy)*(g+hiy)-g*g*g)+6.*n*(Ag*eg*eg+Agy*egy*egy))\ 
/b+2.*g*g*g; 
y=3.*h/4; 
vk1=-F(3.*h/4.,p,q)/f(3.*h/4.,p);            /****at 3/4 length estimated**/ 
vk2=-F((y+vk1),p,q)/f((y+vk1),p); 
y=3.*h/4+vk1+vk2; 
x=y-g; 
I0y=biy*x*x*x/3.-(biy-b)*(x-hiy)*(x-hiy)*(x-hiy)/3.+\ 
n*(Ag*(h-x-a)*(h-x-a)+Agy*(x-ay)*(x-ay)); 
Oh=N*y*x/I0y; 
Ogy=n*Oh*(x-ay)/x; 
Og=n*Oh*(h-x-a)/x; 
Output1(); 
} 
/***************************Circle function************************/ 
float Circle() 
{ 
float R,rg,K,V,W,Q,K0,Ah; 
float PI; 
int degree=0; 
printf("Please input M,N,Ag,n,Eh,l0,Oa,OG,R,rg......\n"); 
printf("M=");scanf("%f",&M); 
printf("N=");scanf("%f",&N ); 
printf("Ag=");scanf("%f",&Ag); 
printf("n=");scanf("%f",&n); 
printf("Eh=");scanf("%f",&Eh); 
printf("l0=");scanf("%f",&l0); 
printf("Oa=");scanf("%f",&Oa); 
printf("OG=");scanf("%f",&OG); 
printf("R=");scanf("%f",&R); 
printf("rg=");scanf("%f",&rg); 
Ah=3.1415*(2*R)*(2*R)/4.; 
A0=Ah+n*Ag; 
I0=3.1415*R*R*R*R/4.+0.5*n*Ag*rg*rg; 
y1=R; 
y2=y1; 
k1=I0/(A0*y1); 
k2=k1; 
e0=M/N; 
Ih=3.14*R*R*R*R/4.; 
e=1./(1.-2.*N/((0.1/(0.2+e0/(2.*R))+0.16)*3.1415*3.1415*Eh*Ih/(l0*l0)))*e0; 
if(e<=k1||e<=k2) 
{ 
printf("This construction is little bias!\n"); 
Oh=N/A0+M*y1/I0; 
Ogy=n*(N/A0+M*(y1-ay)/I0); 
Output(); 
} 
else 
printf("This construction is large bias!\n"); 
PI=3.1415*degree/180.; 
K=0.5*(1.-cos(PI)); 
V=2.*sin(PI)*sin(PI)*sin(PI)-3.*PI*cos(PI)+3.*sin(PI)*cos(PI)*cos(PI); 
W=12.*PI-3.*sin(4*PI)-32.*(sin(PI))*(sin(PI))*(sin(PI))*cos(PI); 
Q=3.*3.1415*cos(PI); 
K0=e/R-(W+24.*n*3.1415*(Ag/Ah)*(rg/R)*(rg/R))/(16.*(V-n*Q*Ag/Ah)); 
for(;(degree>=0)&&(degree<=180)&&(fabs(K0)>=0.005);degree++) 
{ 
PI=3.1415*degree/180.; 
K=0.5*(1.-cos(PI)); 
V=2.*sin(PI)*sin(PI)*sin(PI)-3.*PI*cos(PI)+3.*sin(PI)*cos(PI)*cos(PI); 
W=12.*PI-3.*sin(4*PI)-32.*(sin(PI))*(sin(PI))*(sin(PI))*cos(PI); 
Q=3.*3.1415*cos(PI); 
K0=e/R-(W+24.*n*3.1415*(Ag/Ah)*(rg/R)*(rg/R))/(16.*(V-n*Q*Ag/Ah)); 
} 
Oh=(96.*K*M)/(R*R*R*(W+24.*n*3.1415*(Ag/Ah)*(rg/R)*(rg/R))); 
Og=n*Oh*(R*(1.-2.0*K)+rg)/(2.*K*R); 
Ogy=n*Oh*(R*(2.*K-1.)+rg)/(2.*K*R); 
Output1(); 
} 
/***************************hx function***************************/ 
float hx() 
{ 
float r; 
float R,rg,K,V,W,Q,K0,Ah; 
float K1,K2,K3,V0,W0; 
float PI,PI0; 
int degree=0; 
printf("Please input M,N,Ag,n,Eh,l0,Oa,OG,R,rg......\n"); 
printf("M=");scanf("%f",&M); 
printf("N=");scanf("%f",&N ); 
printf("Ag=");scanf("%f",&Ag); 
printf("n=");scanf("%f",&n); 
printf("Eh=");scanf("%f",&Eh); 
printf("l0=");scanf("%f",&l0); 
printf("Oa=");scanf("%f",&Oa); 
printf("OG=");scanf("%f",&OG); 
printf("R=");scanf("%f",&R); 
printf("rg=");scanf("%f",&rg); 
printf("r=");scanf("%f",&r); 
Ah=3.1415*(R*R-r*r); 
A0=Ah+n*Ag; 
I0=3.1415*(R*R-r*r)*(R*R+r*r+2.*n*rg*rg*Ag/Ah)/4.; 
y=R; 
k1=I0/(A0*y); 
k2=k1; 
e0=M/N; 
Ih=3.1415*(R*R-r*r)*(R*R+r*r)/4; 
e=1./(1.-2.*N/((0.1/(0.2+e0/(2.*R))+0.16)*3.1415*3.1415*Eh*Ih/(l0*l0)))*e0; 
if(e<=k1||e<=k2) 
{ 
printf("This construction is little bias!\n"); 
Oh=N/A0+M*y1/I0; 
Ogy=n*(N/A0+M*(y1-ay)/I0); 
Output(); 
} 
else 
printf("This construction is large bias!\n"); 
PI=3.1415*degree/180.; 
V=2.*sin(PI)*sin(PI)*sin(PI)-3.*PI*cos(PI)+3.*sin(PI)*cos(PI)*cos(PI); 
W=12.*PI-3.*sin(4*PI)-32.*(sin(PI))*(sin(PI))*(sin(PI))*cos(PI); 
Q=3.*3.1415*cos(PI); 
K=0.5*(1-cos(PI)); 
for(;(degree>=0)&&(degree<=(180*acos(r/R)/3.1415));degree++) 
{ 
PI=3.1415*degree/180.; 
V=2.*sin(PI)*sin(PI)*sin(PI)-3.*PI*cos(PI)+3.*sin(PI)*cos(PI)*cos(PI); 
W=12.*PI-3.*sin(4*PI)-32.*(sin(PI))*(sin(PI))*(sin(PI))*cos(PI); 
Q=3.*3.1415*cos(PI); 
K=0.5*(1-cos(PI)); 
K1=e/R-(W+24.*n*3.1415*Ag/Ah*pow((rg/R),2)*(1-pow((r/R),2)))/\ 
(16.*(V-n*Q*Ag/Ah*Q*(1-pow((r/R),2)))); 
if(fabs(K1)<=0.005) 
break; 
} 
for(;(degree>(180*acos(r/R)/3.1415))&&(degree<\ 
(180*acos(-r/R)/3.1415));degree++) 
{ 
PI=3.1415*degree/180; 
PI0=acos(R/r*cos(PI)); 
V0=2.*sin(PI0)*sin(PI0)*sin(PI0)-3.*PI0*cos(PI0)+3.*sin(PI0)*pow(cos(PI0),2); 
W0=12.*PI0-3.*sin(4*PI0)-32.*pow(sin(PI0),3)*cos(PI0); 
K=0.5*(1-cos(PI)); 
V=2.*sin(PI)*sin(PI)*sin(PI)-3.*PI*cos(PI)+3.*sin(PI)*cos(PI)*cos(PI); 
W=12.*PI-3.*sin(4*PI)-32.*(sin(PI))*(sin(PI))*(sin(PI))*cos(PI); 
Q=3.*3.1415*cos(PI); 
K2=e/R-(W-pow((r/R),4)*W0+24*n*3.1415*Ag/Ah*pow((rg/R),2)*\ 
(1-pow((r/R),2)))/(16*(V-pow((r/R),3)*V0-n*Ag/Ah*(1-pow((r/R),2))*Q)); 
if(fabs(K2)<=0.005) 
break; 
} 
for(;(degree>=(180*acos(-r/R)/3.1415))&&(degree>90);degree++) 
{ 
PI=3.1415*degree/180; 
K=0.5*(1-cos(PI)); 
V=2.*sin(PI)*sin(PI)*sin(PI)-3.*PI*cos(PI)+3.*sin(PI)*cos(PI)*cos(PI); 
W=12.*PI-3.*sin(4*PI)-32.*(sin(PI))*(sin(PI))*(sin(PI))*cos(PI); 
Q=3.*3.1415*cos(PI); 
K3=e/R-(W-12*3.1415*pow((r/R),4)+24*n*3.1415*Ag/Ah*\ 
pow((rg/R),2)*(1-pow((r/R),2)))/(16*(V-3*3.1415*(2*K-1)*pow((r/R),2)-\ 
n*Ag/Ah*(1-pow((r/R),2))*Q)); 
if(fabs(K3)<=0.005) 
break; 
} 
if(K1<=0.005) 
{ 
Oh=(96*K*M)/(pow(R,3)*(W+24*n*3.1415*Ag/Ah*pow((rg/R),2)*(1-pow((r/R),2)))); 
Og=(n*Oh*R*(1-2*K)+rg)/(2*K*R); 
Ogy=(n*Oh*R*(2*K-1)+rg)/(2*K*R); 
Output1(); 
} 
else if(K2<=0.005) 
{ 
Oh=(96*K*M)/(pow(R,3)*(W-W0*pow((r/R),4)+24*n*3.1415*Ag/Ah*\ 
pow((rg/R),2)*(1-pow((r/R),2)))); 
Og=(n*Oh*(R*(1-2*K)+rg))/(2*K*R); 
Ogy=(n*Oh*(R*(2*K-1)+rg))/(2*K*R); 
Output1(); 
} 
else if(K3<=0.005) 
{ 
Oh=(96*K*M)/(pow(R,3)*(W-12*3.1415*pow((r/R),4)+24*n*3.1415*Ag/Ah\ 
*pow((rg/R),2)*(1-pow((r/R),2)))); 
Og=(n*Oh*R*(1-2*K)+rg)/(2*K*R); 
Ogy=(n*Oh*R*(2*K-1)+rg)/(2*K*R); 
Output1(); 
} 
} 
/*************************** main function ************************/ 
main() 
{int i,j,k; 
textbackground(4); 
textcolor(14); 
clrscr(); 
printf("1:zxsy\n"); 
printf("2:pxsy\n"); 
printf("3:exit\n"); 
printf("Please input type number:"); 
scanf("%d",&i); 
printf("\n"); 
if(i==1) 
{printf("1:qjz\n"); 
printf("2:xjz\n"); 
printf("3:exit\n"); 
printf("Please input zxsy type number:"); 
scanf("%d",&j); 
if(j==1) 
qjz(); 
else if(j==2) 
xjz(); 
else if(j==3) 
main(); 
else 
printf("Number is wrong!\n"); 
} 
else if(i==2) 
{printf("1:sxjx\n"); 
printf("2:T\n"); 
printf("3:I\n"); 
printf("4:xx\n"); 
printf("5:Circle\n"); 
printf("6:hx\n"); 
printf("7:exit\n"); 
printf("Please input pxsy type number:"); 
scanf("%d",&k); 
if(k==1) 
sxjx(); 
else if(k==2) 
T(); 
else if(k==3) 
I(); 
else if(k==4) 
I(); 
else if(k==5) 
Circle(); 
else if(k==6) 
hx(); 
else if(k==7) 
main(); 
else 
printf("Number is wrong!\n"); exit(0); 
} 
else 
exit(0); 
}