hey sweaties
what's a more efficient/less ugly way of doing this for a multi-dimen array
goal[0][0] = 1;
goal[0][1] = 2;
goal[0][2] = 3;
goal[1][0] = 4;
goal[1][1] = 5;
goal[1][2] = 6;
goal[2][0] = 7;
goal[2][1] = 8;
goal[2][2] = 0;
Attached: 18446641_1382807081788956_4152568392351829136_n.jpg (572x960, 51K)
do you have any idea what a loop is?
Yes I do, I just want something with less program complexity
int n = 0;
for(int i = 0; i < 2; i++){
for(int j = 0; j < 2; j++){
goal[i][j] = n;
n++;
}
}
did i do good?
for (size_t i = 0; i < 3; ++i)
for (size_t j = 0; j < 3; ++j)
goal[i][j] = (i * j) % 9;
it's called a matrix you brainlet
Attached: 8d6.jpg (645x729, 81K)
int n = 0;
for(int i = 0; i < 2; i++){
for(int j = 0; j < 2; j++){
goal[i][j] = n;
n++;
if( n ==8 ) { n =0;}
}
}
for (int i = 0; i < 3; ++i) {
std::iota(goal[i], goal[i] + 3, 3 * i + 1);
}
you fuckin champ, cheers xo