Mam problem z pewną macierzą 5x5:
0 1 2 3 4
15 16 17 18 5
14 23 24 19 6
13 22 21 20 7
12 11 10 9 8
Mój kod:
int main(){
int arry[5][5]; //wiersz x kolumna
for(int i=0; i<5; i++)
for(int j=0; j<5; j++)
if(!(i%2))
arry[i][j] = j;
else
arry[j][5-(i+1)/2)] = j+1+arry[i-1][4];
for(int i=0; i<5; i++){
cout<<endl;
for(int j=0; j<5; j++)
cout<<arry[i][j]<<" ";
}
return 0;
}