If you also want to have, the more loops
Code:
int matrix [rows +1] [column +1], / / you need logically extra row / column for the heads.
/ / Headers for rows and columns
for (i = 0; i <rows; i + +) (
matrix [i] [0] = i;
)
for (i = 0; i <columns; i + +) (
matrix [0] [i] = i;
)
/ / empty boxes and fill everything out.
for (i = 0; i <rows; i + +) (
for (j = 0, j <column; j + +) (
if (i! = 0 & & j! = 0) / / header should not be overwritten ...
matrix [i] [j] = (i-1) * columns + j / / puts the figures are 1.1 to begin with 1
cout <<matrix [i] [j] << "";
)
cout <<endl; / / here is the end of line
)
Bookmarks