Hi!
Edit: Link to my assignment: Programming Challenges-Graphical Editor
One of the requirements of my programming assignment is that a user enters a command along with two numbers. For example, if I entered the following command:
The program create an image like this (it wouldn't be outputted though):I 5 6
It creates a 5 x 6 "image". This is where my troubles begin. The program should also accepts other commands, such as:00000
00000
00000
00000
00000
00000
L 3 2 F
which would produce (also not outputted):
Here is my method for creating an "image" with an M * N array00000
00F00
00000
00000
00000
00000
The code works, but I need to store the image in an array so it can be changed by other methods (I can't create the image manually every time). I tried doing something like this but it doesn't work:
This method outputs as many blank lines as the columns I entered and the memory location of image.
So my question is: how would I store "0" in a 2D array so that it can be accessed and changed by other methods?
Or, am I using a 2D array incorrectly and will the image have to be created manually every time? If so, how would I output image if it is created in a separate method?
Thank you!