I have this program to take properties from a data file and input them into calculations into the program. this is my code at the moment but it isn't taking any values into it.. any help is appreciated
float woodcharacStrength(){
myInfile.open ("strength_classes.txt"); //inputs external file that contains characteristic values for forces parallel to grain.
for (row = 0; row<3; row++)
for (col = 0; col<18; col++) //condition to only read certain rows and columns of the input file
{
myInfile >> arraylocation[row][col]; //used to define each value of the array
}
switch(woodType){
case 'A':
case 'a': ftk = arraylocation[0][0]; fck = arraylocation[1][0];break;
case 'B':
case 'b': ftk = arraylocation[0][1]; fck = arraylocation[1][1];break;
case 'C':
case 'c': ftk = arraylocation[0][2]; fck = arraylocation[1][2];break;
case 'D':
case 'd': ftk = arraylocation[0][3]; fck = arraylocation[1][3];break;
case 'E':
case 'e': ftk = arraylocation[0][4]; fck = arraylocation[1][4];break;
case 'F':
case 'f': ftk = arraylocation[0][5]; fck = arraylocation[1][5];break;
case 'G':
case 'g': ftk = arraylocation[0][6]; fck = arraylocation[1][6];break;
case 'H':
case 'h': ftk = arraylocation[0][7]; fck = arraylocation[1][7];break;
case 'I':
case 'i': ftk = arraylocation[0][8]; fck = arraylocation[1][8];break;
case 'J':
case 'j': ftk = arraylocation[0][9]; fck = arraylocation[1][9];break;
case 'K':
case 'k': ftk = arraylocation[0][10]; fck = arraylocation[1][10];break;
case 'L':
case 'l': ftk = arraylocation[0][11]; fck = arraylocation[1][11];break;
case 'M':
case 'm': ftk = arraylocation[0][12]; fck = arraylocation[1][12];break;
case 'N':
case 'n': ftk = arraylocation[0][13]; fck = arraylocation[1][13];break;
case 'O':
case 'o': ftk = arraylocation[0][14]; fck = arraylocation[1][14];break;
case 'P':
case 'p': ftk = arraylocation[0][15]; fck = arraylocation[1][15];break;
case 'Q':
case 'q': ftk = arraylocation[0][16]; fck = arraylocation[1][16];break;
case 'R':
case 'r': ftk = arraylocation[0][17]; fck = arraylocation[1][17];break;
}
cout <<"The ftk value is: "<< ftk<< endl<<"The fck value is: "<< fck<<endl;
return ftk;
return fck;
myInfile.close();
}
returnstatements in a row. Execution comes to the firstreturnstatement and returns from the function. Thus the 2ndreturnand thefclosewill never be executed. You compiler should have caught this. Turn up the warning level to maximum.