Created
November 26, 2015 09:08
-
-
Save Sprite105/d7c5814401ddc94ea802 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace ConsoleApplication7 | |
{ | |
class Class1 | |
{ | |
private int num = 0; | |
private char[,] mas; | |
public void func(int n) { | |
num = n; | |
mas = new char[n, num]; | |
board(mas); | |
} | |
private void board(char[,] mas) { | |
Console.Write(" "); | |
for (int i = 0; i < num; i++) | |
if (i < 9) Console.Write(" " + (i + 1) + " "); else Console.Write(" " + (i + 1)); | |
Console.WriteLine("\n"); | |
for (int i = 0; i < num; i++) { | |
if (i > 8) Console.Write(i + 1 + " "); else Console.Write(" " + (i + 1) + " "); | |
for (int j = 0; j < num; j++) { | |
if ((((j + 1) + (i + 1)) % 2) == 0) Console.BackgroundColor = ConsoleColor.White; | |
else Console.BackgroundColor = ConsoleColor.Black; | |
Console.Write(mas[i, j] + " "); Console.ResetColor(); | |
} Console.WriteLine(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment