#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/18