首页 > 代码库 > 彩色控制台(随机random)

彩色控制台(随机random)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace eluosi
{
    class Program
    {
        static void Main(string[] args)
        {
            Random r = new Random();
            Console.Title = "彩色控制台";
            while (true)
            {
                Console.BackgroundColor = (ConsoleColor)r.Next(9, 15);
                Console.ForegroundColor = (ConsoleColor)r.Next(9, 15);
                Console.Clear();
                for (int i = 0; i < 10; i++)
                {
                    Console.Write("张君红");
                }
                System.Threading.Thread.Sleep(1000);
            }
           Console.ReadLine();
        }
    }
}

彩色控制台(随机random)