송현호 2023. 7. 21. 10:08
using System;
using System.Diagnostics.CodeAnalysis;
using System.Security.Cryptography;

namespace HelloWorld
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int gold = 500;
            Console.Write("구매 하고자 하는 아이템 이름을 입력하세요 : ");
            string input = Console.ReadLine();
            if (input == "장검")
            {
                Console.WriteLine("장검을 구매 했습니다 (-100골드)");
                gold -= 100;
                Console.WriteLine("소지골드 {0}골드", gold);
            }
            else if (input == "단검")
            {
                Console.WriteLine("단검을 구매 했습니다 (-80골드)");
                gold -= 80;
                Console.WriteLine("소지골드 {0}골드", gold);
            }
            else if (input == "활")
            {
                Console.WriteLine("활을 구매 했습니다 (-120골드)");
                gold -= 120;
                Console.WriteLine("소지골드 {0}골드", gold);
            }
            else
            {
                Console.WriteLine("구매할 수 없는 아이템 입니다.");
            }

            Console.Write("구매 하고자 하는 아이템 이름을 입력하세요 : ");
            string input2 = Console.ReadLine();
            gold = 500;
            switch (input2)
            {
                case "장검":
                    Console.WriteLine("장검을 구매 했습니다 (-100골드)");
                    gold -= 100;
                    Console.WriteLine("소지골드 {0}골드", gold);
                    break;

                case "단검":
                    Console.WriteLine("단검을 구매 했습니다 (-80골드)");
                    gold -= 100;
                    Console.WriteLine("소지골드 {0}골드", gold);
                    break;

                case "활":
                    Console.WriteLine("활을 구매 했습니다 (-120골드)");
                    gold -= 120;
                    Console.WriteLine("소지골드 {0}골드", gold);
                    break;
                
            }
        }
    }
}