Display board with user input

---------
|	|	|	
---------
|	|	|	
---------
|	|	|	
---------

So far, I’ve created a board like this using this code.

 public static void printEmptyBoard(int row, int col) {
        for (int i = 0; i < row; i++) {
            System.out.println("---------");

            for (int j = 0; j < col; j++) {
                System.out.print("|\t");
            }
            System.out.println();
        }
        System.out.println("---------");

    }

required output

I enter a value “X”, a row 1, a column 2.
Now, at row1 and col2, I should see X.
How do I do this?

Is the X supposed to appear as “x” itself or like ASCII art made up of lines spanning multiple rows.

x itself @kirupa

I think you’d want to use i and j in a conditional to see if you’re currently printing out the square that contains your target indices:

func printEmptyBoard(_ row: Int, _ col: Int) {
    let target = (3, 2)
    for i in 0..<row {
        print("---------------------")
        
        for j in 0..<col {
            let targetChar =
                if target == (i + 1, j + 1) { "x" } else { " " }
            print("| \(targetChar) ", terminator: "")
        }
        print("|")
    }
    print("---------------------")
}

…generates:

---------------------
|   |   |   |   |   |
---------------------
|   |   |   |   |   |
---------------------
|   | x |   |   |   |
---------------------
|   |   |   |   |   |
---------------------

what lang is this? can you share a pseudocode/java code instead? Too tough to understand