【发布时间】:2012-09-18 00:10:39
【问题描述】:
我只是贴出伪代码,希望你能理解:
导入 java.util*.;
主要方法{
submethod1();
submethod1() {
Screen input = new Scanner(System.in);
int buy = input.nextInt();
if( buy != 0) {
submethod2();
}
submethod2() {
Screen input = new Scanner(System.in);
int[][]grid = new int [5][6]
int row = input.nextInt();
int col = input.nextint();
grid[row][col] = 1;
假设我这次输入 1 代表行,1 代表列。然后grid[1][1] = 1。我想保存grid[1][1] 的值,以便下次我输入第 2 行第 2 列时:
grid[1][1] = 1;
grid[2][2] = 1; and so on for whatever row-col combination I type.
最后我想回到 submethod1,我想让 submethod1 理解 grid[1][1] = 1 并且 grid[2][2] 也有值 1;等等……
【问题讨论】: