I have a constructor that takes 9 arguments, instead of harcoding each value in an array equal to each argument I was hoping I could run through a loop and set each value of the array column/row equal to the paramater name plus a counter. I named the arguments a, b, c, d, e, f, g, h, and i to try to achieve this.
Code:
Matrix::Matrix(float a, float b, float c, float d, float e, float f, float g, float h, float i)
{
int counter = 0;
for(int i = 0; i < MAX_SIZE; i++)
for(int j = 0; j < MAX_SIZE; j++)
mVals[i][j] = 0x61 + counter++;
//Don't want to hardcore 9 of these
//mVals[0][0] = a;
//mVals[0][1] = b;
}
This is what I was hoping to do, but instead its giving me the decimal value of 0x61 which is 97 + 1, +2, +3...etc.
I've tried a char() cast and I can't get anything to work. MAX_SIZE is 3, using this for a 3x3 matrix. Is this not possible since its a variable name?