C#/C#

[C# 콘솔] 5x5 동그라미판 출력

Rainbow🌈Coder 2022. 2. 2. 22:26
728x90
using System;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.CursorVisible = false;
            const int WAIT_TICK = 1000 / 30;
            const char CIRCLE = '\u25cf';
            int lastTick = 0;
            while(true)
            {
                #region 프레임 관리
                //만약에 경과한 시간이 1/30초 보다 작다면
                int currentTick = System.Environment.TickCount;
                if (currentTick - lastTick < WAIT_TICK) continue;
                lastTick = currentTick;
                #endregion
                //입력

                //로직

                //렌더링
                Console.SetCursorPosition(0, 0);
                for(int i=0; i<25; i++)
                {
                    for(int j=0; j<25; j++)
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.Write(CIRCLE);
                    }
                    Console.WriteLine();
                }
            }

        }
    }
}

728x90