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 91 92 93 94 95 96 97 98 99 100 101 102 103 104

#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <cstdlib>
using namespace std;
void input_data(double& Wv, double& Wp, double& L, double& bw, double& bd, int& Cno);
double total_load( double Wv, double Wp, double bw, double bd);
double max_bending_moment( double Wt, double L);
double Bending_stress(double M , double bd, double bw);
double Design_bending_strength( double kh, double ksys, double kmod, double fmyk, double gamm);
double shear_stress(double Vd, double bw, double bd);
double design_shear_strength(double fvd, double fvk, double kmod, double kv, double ksys, double gamm);
double bearing_stress(double Fc90d, double bw, double L);
double design_bearing_strength(double Fc90k, double kmod, double ksys, double gamm);
int main()
{
double Wv, Wp, L, bw, bd, Wt, M, sigmyd, kh, ksys, kmod, fmyk, gamm, fmyd, Vd, fvd, fvk, kv, fc90d, fc90k;
int Cno, row, col;
input_data(Wv, Wp, L, bw, bd, Cno);
double array[12][12];
ifstream inFile;
inFile.open("data.txt");
if (inFile) {
cout << "Data file found, pulling in the data now...";
for (col = 0; col <= 12; col++)
{
for (row = 0; row <= 12; row++)
{
inFile >> array[col][row];
cout << array[col][row]<< endl;
}
}
} else {
cout << "Data file not found!"<<endl;
}
inFile.close();
Wt=total_load( Wv, Wp, bw, bd);
M = max_bending_moment(Wt, L);
sigmyd = Bending_stress(M,bd,bw);
cout<< "The total load on the beam is "<<Wt<< endl;
cout<< "the maximum bending moment of the beam is "<<M<<endl;
cout<< "the Bending stress of the beam is "<<sigmyd<<endl;
return 0;
}
void input_data(double& Wv, double& Wp, double& L, double& bw, double& bd, int& Cno)
{
cout<< "input the Length of the beam: "<<endl;
cin>> L;
cout<< "input the width of the beam: "<<endl;
cin>> bw;
cout<< "input the depth of the beam: "<<endl;
cin>> bd;
cout<< "input the Variable characteristic load: " <<endl;
cin>> Wv;
cout<< "input the Permanent characteristic load: "<<endl;
cin>> Wp;
cout<< "input the strength characteristic of the beam"<<endl;
cin>> Cno;
}
double total_load( double Wv, double Wp, double bw, double bd) //computation of the total load on single beam
{
return ((1.35*Wp)+(1.5*Wv))*bw*bd;
}
double max_bending_moment( double Wt, double L) // computing maximum bendeing moment using value of total load wt
{
return Wt*L/8.0;
}
double Bending_stress(double M , double bd, double bw)
{
return (M*bd/2)/(bw*pow(bd,3))/12;
}
double Design_bending_strength( double kh, double ksys, double kmod, double fmyk, double gamm)
{
return (kh*ksys*kmod*fmyk)/gamm;
}
double shear_stress(double Vd, double bw, double bd)
{
return (3*Vd)/(2*bw*bd);
}
double design_shear_strength(double fvd, double fvk, double kmod, double kv, double ksys, double gamm)
{
return (fvk*kmod*kv*ksys)/gamm;
}
double bearing_stress(double Fc90d, double bw, double L)
{
return Fc90d/(bw*L);
}
double design_bearing_strength(double Fc90k, double kmod, double ksys, double gamm)
{
return (Fc90k*kmod*ksys)/gamm;
}
 