📄 main1.cpp
字号:
#include <iostream>
using std::cout;
using std::endl;
#include <cmath>
int main()
{
//初始变量数据设置 基本单位统一为毫米( mm )
float f_op = 3;
float f_oe = 3;
float f_oe_1 = f_oe;
float f = 2.0;
float i_y = 5.24 * pow(10.0,6); //单位 mm^4
float beita = 2.0;
float Q = 8.4; //单位 N/mm
float R = 6 * pow(10.0,5);
float E = 2.1 * pow(10.0,5);
float L_0 = 4000.0;
float pi = 3.1415926;
float L_2 = 0; //L的平方
float L = 0;
float A = beita * E * i_y * pow(pi,2);
float B = ( 1/R + 8 * f_op / pow(L_0,2) );
float C = 0;
int i= 0;//计算循环次数
while(1)
{
C = sqrt( pow(A*B,2) + ( A * pow(pi,3)/4 ) * ( f + f_oe ) * Q );
L_2 = (A * B + C)/Q;
L = sqrt(L_2);
i++;
if( abs( L - L_0 ) >= 10 ) //此处系数 9或10
{
//cout <<L<<endl;
L_0 = L;
f_oe = L_2 * f_oe_1/pow(4000.0,2);
// cout<<f_oe<< endl;
}
else
{
cout << "L= " << L << endl;
cout << "f_oe= " << f_oe << endl;
cout << "计算进行次数: "<< i;
break;
}
//f_oe = pow(L,2) * f_oe/4000;
//cout << A << endl << C << endl << L;
//break;
}
getchar();
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -