using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using static System.Console;


namespace ConsoleApp12

{

    class Program

    {

        static void Main(string[] args)

        {

            WriteLine("정수를 입력하세요.");


        Main:                           //메인


            string s = ReadLine();

            object obj = null;

            if (int.TryParse(s, out int out_i))

                obj = out_i;


            else if (float.TryParse(s, out float out_f))

                obj = out_f;


            else

                obj = s;



            switch (obj)

            {

                case int i:

                    goto Cal;


                case float f:

                    WriteLine("정수를 입력해주세요.");

                    goto Main;


                default:

                    WriteLine("숫자를 입력해주세요.");

                    goto Main;

            }


        Cal:/*                                               메모리 계산*/

            int iunbox = (int)obj; //언박싱.

            WriteLine();

            WriteLine("비트를 이동시킬 양을 정수로 적으세요. 이동할 방향을 양수/음수로 표현하세요.");


            string b = ReadLine();

            object obj2 = null;

            if (int.TryParse(b, out int out2_i))

                obj2 = out2_i;


            else if (float.TryParse(b, out float out2_f))

                obj2 = out2_f;


            else

                obj2 = b;

            int iunbox2 = (int)obj2;/*                              언박싱*/

           

            switch (obj2)

                {

                    case 0:

                        WriteLine("0은 이동할 수 없어요.");

                        goto Cal;


                    case int i:

                    goto CalM;


                    case float f2:

                        WriteLine("정수를 입력해주세요.");

                        goto Main;


                    default:

                        WriteLine("숫자를 입력해주세요.");

                        goto Cal;


                }


        CalM://메모리 계산 영역


            int M = (int)obj2;


            if (iunbox2 > 0) 

            {

                int imove = iunbox >> M;

                WriteLine($"{M} 만큼 이동되었습니다. ^^7");

                WriteLine($"이동된 수의 값: {imove}");

                goto End;

            }


            if (iunbox2

            {

                int imove = iunbox << Math.Abs(M); ;

                WriteLine($"{M} 만큼 이동되었습니다. ^^7");

                WriteLine($"이동된 수의 값: {imove}");

                goto End;

            }


        End:                   //종료

            return;

        }

    }

}


일기는 인붕갤에!