1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
void display_message (int n);
void inputs (int n);
void outputs (int n);
int service_class;
float timber, bending, moe_parallel, density, mean_density, length, depth, width;
float variable_load, kmod, joist, choice, self_weight, perm_load;
float tension_parallel, tension_perp, comp_parallel, comp_perp, shear, five_parallel;
float mass, Design_action, max_moment, secondmoment, design_stress, bending_stress;
float moe_perp, mean_shear, design_strength, Vd, shearstress, designshear;
int main ()
{
cout << "This program is designed to calculate whether or not your solid timber beam " << endl;
cout << "will be able to withstand a given load (in shear and tension/compression)." << endl;
cout << "Enjoy!" << endl;
inputs (1);
outputs (1);
display_message (1);
system ("PAUSE");
return 0;
}
void inputs (int n)
{
cout << "Firstly, is your timber a hardwood or a softwood?" << endl; // For later calculations, factors vary in softwoods and hardwoods
char choice;
cout << "Enter 1 for hardwood, or 1 for softwood" << endl;
cin >> choice;
while(choice != '1' && choice != '2')
{
cout << "Invalid selection. Please re-enter: ";
cin >> choice;
}
cout << "Now please find the beam stiffness and strength properties, commonly found" << endl;
cout << " in the 'Strength Class' tables for softwood and hardwood." << endl;
cout << "Enter the characteristic value for bending strength (Classed under " << endl;
cout << " 'Strength Properties') [in N/mm^2]: "<< endl; // Fewest number of inputs without using an array
cin >> bending;
cout << "Now please enter the mean characteristic value of modulus of " << endl;
cout << "elasticity parallel to the grain (found under 'Stiffness Properties')" << endl;
cin >> moe_parallel;
cout << "The following information is also required:" <<endl;
cout << "Enter the density [in kg/m^3]" << endl;
cin >> density;
cout << "Enter the mean density [in kg/m^3]" << endl;
cin >> mean_density;
cout << "Enter the beam length [in m]" <<endl;
cin >> length;
cout << "Enter the beam depth [in m]" << endl;
cin >> depth;
cout << "Enter the beam width [in m]" << endl;
cin >> width;
cout << "Enter the distance between joists. If joists do not exist or " << endl;
cout << "are not known, input the beam length [in m]" << endl;
cin >> joist; // Possibly problematic if joists are not used, but info is needed for shear values
cout << "Enter the self weight of beam [in kN/m^2]" << endl;
cin >> self_weight;
cout << "Enter the permanent loading [in kN/m^2]" << endl;
cin >> perm_load;
cout << "Enter the variable loading [in kN/m^2]" << endl;
cin >> variable_load;
}
|