I need to make a function to initalize the diagonals of an array of 10 vectors to any one floating point number passed as a parameter. The part that I'm unsure of is to initalize the diagonals, how would this be done?
Thanks
K
Printable View
I need to make a function to initalize the diagonals of an array of 10 vectors to any one floating point number passed as a parameter. The part that I'm unsure of is to initalize the diagonals, how would this be done?
Thanks
K
One solution is a loop. Given there is a 10x10 matrix, here is one solution.
KuphrynCode:int nCol = 0;
// Top left to lower right
for (int i = 0; i < 10; ++i)
array[i][i + nCol++];