c ++结构工程具体设计

时间:2014-09-21 19:42:39

标签: c++

您好我已经编写了下面的程序来计算钢筋混凝土梁的弯矩能力,我想知道的是有什么技巧我可以用它来改进它的功能,从头开始学习c ++,程序工作似乎很高兴基本。所有评论都赞赏。

    // Concrete Design 
/* A simple program to calculate moment and shear capacity of rectangular cross sections */

#include <iostream>
#include <algorithm>    // std::max
using namespace std;

int main()
{
    cout << "Concrete Design to BS 5400 Part 4\n\n";

    //Variables

    double iFcu;                    //Concrete strength (Typically taken as 40N/mm2) 
    double iFy;                     //Charactersitic yield strength of reinforcement (Typically taken as 500N/mm2) 
    double iEs;                     //Elastic modulus of steel (Typically taken as 200,000N/mm2) 
    double iYm;                     //Reinforcement factor (Typically taken as 1.15)
    double iYf3;                    //Safety factor (Typically taken as 1.1)
    double iWidth;                  //Width of concrete (Typically taken as a metre strip i.e. 1000mm) 
    double iDepth;                  //Depth of concrete (Typically taken as 500mm) 
    double iDrein;                  //Depth to reinforcement (Typically taken as 50mm from bottom i.e. 450mm)
    double iAreaRef;                //Area of reinforcement (Typically taken as 2500mm2 assuming 20mm bars spaced at 125mm)
    double dLever;                  //Lever arm (used in calculation of moment capacity) 
    double iMus;                    //Equation 1, moment capacity of steel (formula from BS5400 part 4)
    double iMuc;                    //Equation 2, moment capacity of concrete (formula from BS5400 part 4)

    //Input

    cout << "\n***** All units are in SI ******\n";
    cout << "\nCharacteristic Strength of Concrete (N/mm2): ", cin >> iFcu;
    cout << "\nCharacteristic Strength of Reinforcement (N/mm2): ", cin >> iFy;
    cout << "\nElastic modulus of Reinforcement (N/mm2): ", cin >> iEs;
    cout << "\nPartial reinforcement factor (Typically 1.15): ", cin >> iYm;
    cout << "\nPartial factor of safety (Typically 1.1): ", cin >> iYf3;
    cout << "\nWidth of Concrete (mm): ", cin >> iWidth;
    cout << "\nDepth of Concrete (mm): ", cin >> iDepth;
    cout << "\nDepth of Reinforcement (mm): ", cin >> iDrein;
    cout << "\nArea of reinforcement (mm2): ", cin >> iAreaRef;

    //Moment Capacity

    dLever = min((0.95*iDrein),(1-((1.1*iFy*iAreaRef)/(iFcu*iWidth*iDrein)))*iDrein);
    iMus = 0.87*iFy*iAreaRef*dLever;
    iMuc = 0.15*iFcu*iWidth*pow(iDrein,2);

    cout << "\nThe lever arm is: " << dLever << " mm";
    cout << "\n\nThe moment capacity of the section is: " << min(iMus,iMuc)/(1000*1000) << " kNm\n";
    cout << "\nPercentage of Tensile reinforcement: " << 100*iAreaRef/(iWidth*iDrein) << " %\n";

    return 0;
}

0 个答案:

没有答案
相关问题