I am new to coding so any advice on a more efficient method would be much appreciated, thankyou!
void BendingStrength()
{
cout << endl;
cout << "Please enter your solid timbers strength class where C14=0, C16=1, C18=2, C20=3, C22=4, C24=5, C27=6, C30=7, C35=8, C40=9, C45=10, C50=11, D30=12, D35=13, D40=14, D50=15, D60=16, D70=17: ";
int StrengthClass[1][18]={14000,16000,18000,20000,22000,24000,27000,30000,35000,40000,45000,50000,30000,35000,40000,50000,60000,70000};
cin >> strengthclassnumber;
switch(strengthclassnumber)
{
case 0:
{
fk=StrengthClass[0][0];
cout << "The benching strength, fk, of your beam is " << fk << "kN/m2";
cout << endl;
break;
}
case 1:
{
fk=StrengthClass[0][1];
cout << "The benching strength, fk, of your beam is " << fk << "kN/m2";
cout << endl;
break;
}
case 3:
{
fk=StrengthClass[0][3];
cout << "The benching strength, fk, of your beam is " << fk << "kN/m2";
cout << endl;
break;
}
case 4:
{
fk=StrengthClass[0][4];
cout << "The benching strength, fk, of your beam is " << fk << "kN/m2";
cout << endl;
break;
}
case 5:
{
fk=StrengthClass[0][5];
cout << "The benching strength, fk, of your beam is " << fk << "kN/m2";
cout << endl;
break;
}
case 6:
{
fk=StrengthClass[0][6];
cout << "The benching strength, fk, of your beam is " << fk << "kN/m2";
cout << endl;
break;
}
case 7:
{
fk=StrengthClass[0][7];
cout << "The benching strength, fk, of your beam is " << fk << "kN/m2";
cout << endl;
break;
}
case 8:
{
fk=StrengthClass[0][8];
cout << "The benching strength, fk, of your beam is " << fk << "kN/m2";
cout << endl;
break;
}
case 9:
{
fk=StrengthClass[0][9];
cout << "The benching strength, fk, of your beam is " << fk << "kN/m2";
cout << endl;
break;
}
case 10:
{
fk=StrengthClass[0][10];
cout << "The benching strength, fk, of your beam is " << fk << "kN/m2";
cout << endl;
break;
}
case 11:
{
fk=StrengthClass[0][11];
cout << "The benching strength, fk, of your beam is " << fk << "kN/m2";
cout << endl;
break;
}
case 12:
{
fk=StrengthClass[0][12];
cout << "The benching strength, fk, of your beam is " << fk << "kN/m2";
cout << endl;
break;
}
case 13:
{
fk=StrengthClass[0][13];
cout << "The benching strength, fk, of your beam is " << fk << "kN/m2";
cout << endl;
break;
}
case 14:
{
fk=StrengthClass[0][14];
cout << "The benching strength, fk, of your beam is " << fk << "kN/m2";
cout << endl;
break;
}
case 15:
{
fk=StrengthClass[0][15];
cout << "The benching strength, fk, of your beam is " << fk << "kN/m2";
cout << endl;
break;
}
case 16:
{
fk=StrengthClass[0][16];
cout << "The benching strength, fk, of your beam is " << fk << "kN/m2";
cout << endl;
break;
}
case 17:
{
fk=StrengthClass[0][17];
cout << "The benching strength, fk, of your beam is " << fk << "kN/m2";
cout << endl;
break;
}
case 18:
{
fk=StrengthClass[0][18];
cout << "The benching strength, fk, of your beam is " << fk << "kN/m2";
cout << endl;
break;
}
default:
{
cout << "This value has not been assigned to a strength class."
<< endl;
cout <<endl;
return BendingStrength();
}
}
}

New Topic/Question
Reply



MultiQuote




|