C#

늑대1

s0002 2023. 1. 2. 12:55
            int hp = 10;
            int maxHp = 10;
            int offensePower = 5;

            Console.WriteLine("영웅의 체력은 {0}/{1}입니다.", hp, maxHp);
            Console.WriteLine("늑대의 공격력은 {0}입니다", offensePower);

            Console.WriteLine("늑대에게 공격({0})을 받았습니다", offensePower);

            hp = hp - offensePower;

            Console.WriteLine("영웅의 체력은 {0}/{1}입니다", hp, maxHp);
            if (hp == 0)
            {
                Console.WriteLine("영웅이 전사했습니다");
            }

            Console.WriteLine("늑대에게 공격({0})을 받았습니다", offensePower);

            hp = hp - offensePower;

            Console.WriteLine("영웅의 체력은 {0}/{1}입니다", hp, maxHp);
            if (hp == 0)
            {
                Console.WriteLine("영웅이 전사했습니다");
            }
            Console.WriteLine("영웅이 부활했습니다");
            hp = maxHp;
            Console.WriteLine("영웅의 체력은 {0}/{1}입니다.", hp, maxHp);