Untitled
unknown
c_cpp
a year ago
1.6 kB
0
Indexable
Never
class Program { static void Main(string[] args) { Random r = new Random(); int size = r.Next(1, 5); int r_size = 4 * size + 1; string[,] array = new string[r_size, r_size]; for (int y = 0; y < r_size; y++) { for (int x = 0; x < r_size; x++) { array[y, x] = "*"; } } for (int y = 0; y < r_size; y++) { for (int x = 0; x < r_size; x++) { Console.Write(array[y, x] + " "); } Console.WriteLine(); } int rows = 9; int cols = 9; string[,] Array = new string[rows, cols]; void pattern_trytodrawthis(string[,] array_Pattern, int rows, int cols) { int x=0, y=0; while ( y < size && x <size) { if(x == size-1) if(y == size-1) for ( y = 0; y < rows; y++) { for ( x = rows; x < cols -3; x++) { array_Pattern[y, x] = " "; } array_Pattern[y, rows] = "* "; } } } pattern_trytodrawthis(Array, rows, cols); Console.WriteLine("\nPattern:"); for (int y = 0; y < rows; y++) { for (int x = 0; x < cols; x++) { Console.Write(Array[y, x]); } Console.WriteLine(); } } }