Obviously, integer should be replaced by the appropriate data type.declare A as integer array of size [ROWS][COLUMNS] or declare A as integer array of size (ROWS, COLUMNS) declare A as integer array of size [5][6] declare A as integer array of size (5, 6)
IB papers may have defined it for you, or they may not ask you at all to define the size. You could define it (unknown size) as
...then you'd use it likedeclare A as integer array of size [ ][ ]
I'd recommend going for the [ ][ ] style as it'd be more consistent with the single dimensional arrays described in the IB pseudocode documents mentioned above.loop ROW from 0 to 5 loop COL from 0 to 6 output A[ROW][COL] or output A(ROW, COL) end loop end loop
3 comments:
Hi,
Useful links. Understood the concept. Thanks for sharing.
Cheers,
http://www.flowerbrackets.com/two-dimensional-array-java-program/
java 2d graphic examples
Drawing Shapes in Java
Using a 2-dimensional array, display things in a manner below using a loop structure. pseudo code
8 7 6
5 4 3
2 1 0
Post a Comment