남영운 :: 몬스터에게 받는 부동소수점 데미지로 체력 까이기(19.09.20)

몬스터에게 받는 부동소수점 데미지로 체력 까이기(19.09.20)

Console(콘솔)/실습 2019. 9. 20. 13:45
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Syntax03
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("캐릭터의 이름을 입력해주세요. ");
            string characterName = Console.ReadLine();
            Console.Write("직업을 설정해주세요. ");
            string className = Console.ReadLine();
            Console.Write("전체체력을 설정해주세요. ");
            string maxHp = Console.ReadLine();
            int a = int.Parse(maxHp);
            Console.Write("공격력을 설정해주세요. ");
            string heroDamage = Console.ReadLine();
            int b = int.Parse(heroDamage);
            Console.WriteLine("------------------------------");
            Console.WriteLine("이름 : " + characterName);
            Console.WriteLine("직업 : " + className);
            Console.WriteLine("체력 : " + a + "/" + a);
            Console.WriteLine("공격력 : " + b);
            Console.WriteLine("------------------------------");
            Console.WriteLine("[step3]for문을 사용하세요.");
            Console.WriteLine("던전으로 들어갔습니다.");
            for(float d =3.5f;d<=a;d+=3.5f)
            {
                Console.WriteLine("몬스터에게 공격" + "(" + 3.5 + ")" + "을 받았습니다." + (a - d) + "/" + a);
}
        }
    }
}
 
 
 

 

: