2019-10-23 23일차 재귀함수(2)

Console Programming/C# Console 2019. 10. 24. 10:33

행렬의 요소를  Move를 사용해서 1번째 열에서 마지막 열까지 옮겼다.

Move는 안에서 스스로를 호출한다.

 

Program.cs

namespace Syntax02
{
    class Program
    {
        static void Main(string[] args)
        {
            new App();
        }
    }
}

App.cs

using System;
namespace Syntax02
{
    public class App
    {
        private int[] arr;

        public App()
        {
            //SayHello();

            //Gugudan(2, 1);

            arr = new int[5] { 2, 0, 0, 0, 0 };

            Show();
            Move(0);

            Show();


        }
        public bool Check(int nextIndex)
        {
            if (nextIndex>=0 && nextIndex 10)
            {
                return;
            }
            cnt++;
            this.SayHello();
            
        }
    }
}

 

 

: