본문 바로가기

ETC Programmings

처음으로 만든 Windows Console Application

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

using System;

using System.Collections.Generic;

using System.Text;

 

namespace 잇힝유후

{

    public class FirstCsApp

    {

        static bool isContinued = true;

        public static void Main(String[] args)

        {

            while (isContinued)

            {

                Console.WriteLine("What's your favorite day of the Week? ex) Monday, Tuseday, Wed, thursday");

                try

                {

 

                    String msg = (string)Console.ReadLine();

                    String parsedMsg = msg.ToUpper().Substring(0, 2);

                    verifyMsg(parsedMsg);

                }

                catch (Exception e)

                {

                    e.ToString();

                    Console.WriteLine("Retry...");

                }            

            }

        }

        private static void verifyMsg(String parsedMsg)

        {

            switch (parsedMsg)

            {

                case "MO":

                    Console.WriteLine("월래 보고 싶은 날");

                    break;

                case "TU":

                    Console.WriteLine("화가나도 보고 싶은 날");

                    break;

                case "WE":

                    Console.WriteLine("수도 없이 보고 싶은 날");

                    break;

                case "TH":

                    Console.WriteLine("목마르도록 보고 싶은 날");

                    break;

                case "FR":

                    Console.WriteLine("금방 보고 싶은 날");

                    break;

                case "SA":

                    Console.WriteLine("토끼같은 너를 보고 싶은 날");

                    break;

                case "SU":

                    Console.WriteLine("일찍부터 너를 보고 싶은 날");

                    break;

                case "XX" :

                    for (int i = 0; i < 300; i++ )

                    {

                        Console.WriteLine("일주일중에 단 하루도 당신을 보고 싶지 않은 날이 없어요 ^^*");

                    }

                    FirstCsApp.isContinued = false;

                    break;

                default:

                    Console.WriteLine("무슨날인지는 몰라도 보고 싶은 날");

                    break;

            }

        }

    }

}

 

후후.. 처음으로 머리를 굴려서 만든 C# 콘솔 프로그램입니다. 다른건 거의 자바와 같아서 만드는데 크게 어려움은 없었어요 ㅎㅎ 여자친구한테 보여줄라고 만든건데 ~_~ 엉겁결에 배우게된 string API와 예외처리 ~_~ ㅋㅋ 재미있어효..