Advertisement
Guest User

1

a guest
Nov 14th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.44 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. namespace Task5
  5. {
  6.     class ConsolePlate
  7.     {
  8.         char _plateChar;
  9.         ConsoleColor _plateColor = ConsoleColor.Magenta;
  10.         ConsolePlate()
  11.         {
  12.             _plateChar = '+';
  13.         }
  14.         public ConsolePlate(char Symbol, ConsoleColor Color)
  15.         {
  16.             this._plateChar = Symbol;
  17.             this._plateColor = Color;
  18.         }
  19.         public char ColorTest
  20.         {
  21.             get
  22.             {
  23.                 char line;
  24.                 if (_plateChar <= 100)
  25.                 {
  26.                     Console.ResetColor();
  27.                     Console.ForegroundColor=ConsoleColor.Green;
  28.                     this._plateChar = '+';
  29.                 }
  30.                 else
  31.                 {
  32.                     Console.ResetColor();
  33.                     Console.ForegroundColor = ConsoleColor.Magenta;
  34.                 }
  35.                 line = _plateChar;
  36.                 return line;
  37.             }
  38.         }
  39.     }
  40.     class Program
  41.     {
  42.         static Random rnd = new Random();
  43.         static void Main()
  44.         {
  45.             char symbol;
  46.             for(int i = 0; i < 1000; i++)
  47.             {
  48.                 symbol = (char)rnd.Next('?', '~');
  49.                 ConsolePlate d = new ConsolePlate(symbol, ConsoleColor.Magenta);
  50.                 Console.Write(d.ColorTest + " ");
  51.             }
  52.             Console.WriteLine();
  53.             Console.ResetColor();
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement