4.21 - Two-dimensional array as buffer for screen


Create a C# program that declares a 70x20 two-dimensional array of characters, "draws" 80 letters (X, for example) in random positions and displays the content of the array on screen.


using System;

public class Array2Drandom
    public static void Main ()
        char[,] position = new char[20,70];
        Random generator = new Random();
        for(int i=0; i < 80; i++)
            position[generator.Next(0,20), generator.Next(0,70)]='X';
        for(int row=0; row < 20; row++)
            for(int column=0; column<70 data-blogger-escaped-column="" data-blogger-escaped-console.write="" data-blogger-escaped-console.writeline="" data-blogger-escaped-position="" data-blogger-escaped-pre="" data-blogger-escaped-row="">

Popular Posts