Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Task5
- {
- class ConsolePlate
- {
- char _plateChar;
- ConsoleColor _plateColor = ConsoleColor.Magenta;
- ConsolePlate()
- {
- _plateChar = '+';
- }
- public ConsolePlate(char Symbol, ConsoleColor Color)
- {
- this._plateChar = Symbol;
- this._plateColor = Color;
- }
- public char ColorTest
- {
- get
- {
- char line;
- if (_plateChar <= 100)
- {
- Console.ResetColor();
- Console.ForegroundColor=ConsoleColor.Green;
- this._plateChar = '+';
- }
- else
- {
- Console.ResetColor();
- Console.ForegroundColor = ConsoleColor.Magenta;
- }
- line = _plateChar;
- return line;
- }
- }
- }
- class Program
- {
- static Random rnd = new Random();
- static void Main()
- {
- char symbol;
- for(int i = 0; i < 1000; i++)
- {
- symbol = (char)rnd.Next('?', '~');
- ConsolePlate d = new ConsolePlate(symbol, ConsoleColor.Magenta);
- Console.Write(d.ColorTest + " ");
- }
- Console.WriteLine();
- Console.ResetColor();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement