mardi 13 août 2019

Adding of matrix operation. between rectangles

The problem is putting the random numbers in between the square in the rectangles and adding them. You can look at the desired output. I already have the code for the rectangle which using length and with. I'll just convert it to column and rows. But the problem is putting the random numbers between .

    int len, wid;


    String sep = "+---";
    String w_block = "|   ";

    for(int i = 0; i < wid; i++)
    {
        for(int j = 0; j < len; j++)
        {
            out.print(sep);
        }
        out.print("+\n");

        for(int k = 0; k < len; k++)
        {
            out.print(w_block);
        }
        out.print("|\n");
    }

    for(int j = 0; j < len; j++)
    {
        out.print(sep);
    }
    out.print("+");  

I expect the output to be like thisexpected outcome




Aucun commentaire:

Enregistrer un commentaire