commit 8ab7ba76cc3b71851c6208e931adbbb7397628aa Author: SwEdryG Date: Wed Jun 10 23:31:35 2026 +0300 Добавить Program.cs diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..a1bd35b --- /dev/null +++ b/Program.cs @@ -0,0 +1,234 @@ +using static Display_Segments; +using static Print_Segment; +class Display_7 +{//▓ + static char[,] First_Display = new char[9, 8]; + static char[,] Second_Display = new char[9, 8]; + static char[,] Two_Point = new char[9, 3]; + static char[,] Thirst_Display = new char[9, 8]; + static char[,] Fourth_Display = new char[9, 8]; + static char[,] Second1_Display = new char[9, 8]; + static char[,] Second2_Display = new char[9, 8]; + + + static void Main() + { + Console.ForegroundColor = ConsoleColor.Cyan; + Console.Title = "Часы"; + Console.CursorVisible = false; + Console.SetWindowSize(70, 10); + Console.SetBufferSize(70, 10); + while (true) + { + DateTime now = DateTime.Now; + int h1 = now.Hour / 10; + int h2 = now.Hour % 10; + + int m1 = now.Minute / 10; + int m2 = now.Minute % 10; + + int s1 = now.Second / 10; + int s2 = now.Second % 10; + + ClearDisplay(First_Display); + ClearDisplay(Second_Display); + ClearDisplay(Thirst_Display); + ClearDisplay(Fourth_Display); + ClearDisplay(Second1_Display); + ClearDisplay(Second2_Display); + + DrawAnyDigit(First_Display, h1); + DrawAnyDigit(Second_Display, h2); + DrawAnyDigit(Thirst_Display, m1); + DrawAnyDigit(Fourth_Display, m2); + DrawAnyDigit(Second1_Display, s1); + DrawAnyDigit(Second2_Display, s2); + + PrintPoint(Two_Point); + + Print(); + Thread.Sleep(1000); + } + + } + static void PrintPoint(char[,] mass) + { + ClearPoint(mass); + if (DateTime.Now.Second % 2 == 0) + { + mass[2, 1] = '▓'; + mass[6, 1] = '▓'; + } + } + static void Print() + { + Console.SetCursorPosition(0, 0); + for (int i = 0; i < 9; i++) + { + //1 цифра + for (int j = 0; j < 8; j++) Console.Write(First_Display[i, j]); + Console.Write(" "); + + //2 цифра + for (int j = 0; j < 8; j++) Console.Write(Second_Display[i, j]); + Console.Write(" "); + + //точки + for (int k = 0; k < 3; k++) Console.Write(Two_Point[i, k]); + Console.Write(" "); + + //3 цифра + for (int j = 0; j < 8; j++) Console.Write(Thirst_Display[i, j]); + Console.Write(" "); + + //4 цифра + for (int j = 0; j < 8; j++) Console.Write(Fourth_Display[i, j]); + Console.Write(" "); + + //точки + for (int k = 0; k < 3; k++) Console.Write(Two_Point[i, k]); + Console.Write(" "); + + //5 цифра + for (int j = 0; j < 8; j++) Console.Write(Second1_Display[i, j]); + Console.Write(" "); + + //6 цифра + for (int j = 0; j < 8; j++) Console.Write(Second2_Display[i, j]); + Console.Write(" "); + + Console.WriteLine(); + } + } + + +} +class Display_Segments +{ + + public static void V_Segment(char[,] Display, int stroka, int stolbets) + { + for (int i = stroka; i < stroka + 3; i++) + { + if (i < 9) Display[i, stolbets] = '▓'; + } + } + public static void H_Segment(char[,] Display, int stroka, int stolbets) + { + for (int i = stolbets; i < stolbets + 6; i++) + { + if (i < 8) Display[stroka, i] = '▓'; + } + } + public static void ClearDisplay(char[,] Display) + { + for (int i = 0; i < 9; i++) + for (int j = 0; j < 8; j++) + Display[i, j] = ' '; + } + public static void ClearPoint(char[,] Display) + { + for (int i = 0; i < 9; i++) + for (int j = 0; j < 3; j++) + Display[i, j] = ' '; + } +} +class Print_Segment() +{ + public static void Print_1(char[,] mass) + { + V_Segment(mass, 1, 7); //2 + V_Segment(mass, 5, 7); //3 + } + public static void Print_2(char[,] mass) + { + H_Segment(mass, 0, 1); //1 + V_Segment(mass, 1, 7); //2 + H_Segment(mass, 4, 1); //7 + V_Segment(mass, 5, 0); //5 + H_Segment(mass, 8, 1); //4 + } + public static void Print_3(char[,] mass) + { + H_Segment(mass, 0, 1); //1 + V_Segment(mass, 1, 7); //2 + H_Segment(mass, 4, 1); //7 + V_Segment(mass, 5, 7); //3 + H_Segment(mass, 8, 1); //4 + } + public static void Print_4(char[,] mass) + { + V_Segment(mass, 1, 0); //6 + V_Segment(mass, 1, 7); //2 + H_Segment(mass, 4, 1); //7 + V_Segment(mass, 5, 7); //3 + } + public static void Print_5(char[,] mass) + { + H_Segment(mass, 0, 1); //1 + V_Segment(mass, 1, 0); //6 + H_Segment(mass, 4, 1); //7 + V_Segment(mass, 5, 7); //3 + H_Segment(mass, 8, 1); //4 + } + public static void Print_6(char[,] mass) + { + H_Segment(mass, 0, 1); //1 + V_Segment(mass, 1, 0); //6 + H_Segment(mass, 4, 1); //7 + V_Segment(mass, 5, 7); //3 + H_Segment(mass, 8, 1); //4 + V_Segment(mass, 5, 0); //5 + } + public static void Print_7(char[,] mass) + { + H_Segment(mass, 0, 1); //1 + V_Segment(mass, 1, 7); //2 + V_Segment(mass, 5, 7); //3 + } + public static void Print_8(char[,] mass) + { + H_Segment(mass, 0, 1); //1 + V_Segment(mass, 1, 7); //2 + V_Segment(mass, 5, 7); //3 + H_Segment(mass, 8, 1); //4 + V_Segment(mass, 5, 0); //5 + V_Segment(mass, 1, 0); //6 + H_Segment(mass, 4, 1); //7 + } + public static void Print_9(char[,] mass) + { + H_Segment(mass, 0, 1); //1 + V_Segment(mass, 1, 7); //2 + V_Segment(mass, 5, 7); //3 + H_Segment(mass, 8, 1); //4 + V_Segment(mass, 1, 0); //6 + H_Segment(mass, 4, 1); //7 + } + public static void Print_0(char[,] mass) + { + H_Segment(mass, 0, 1); //1 + V_Segment(mass, 1, 7); //2 + V_Segment(mass, 5, 7); //3 + H_Segment(mass, 8, 1); //4 + V_Segment(mass, 5, 0); //5 + V_Segment(mass, 1, 0); //6 + } + + public static void DrawAnyDigit(char[,] mass, int digit) + { + switch (digit) + { + case 0: Print_0(mass); break; + case 1: Print_1(mass); break; + case 2: Print_2(mass); break; + case 3: Print_3(mass); break; + case 4: Print_4(mass); break; + case 5: Print_5(mass); break; + case 6: Print_6(mass); break; + case 7: Print_7(mass); break; + case 8: Print_8(mass); break; + case 9: Print_9(mass); break; + } + } +} \ No newline at end of file