using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Study02
{
class Program
{
enum ItemType
{
SWORD, DAGGER
}
static void Main(string[] args)
{
string hero = "Alan";
string enemy;
string heroPow;
int enemyMaxhp;
int enemyhp;
int hheroPow;
enemy = "고블린";
heroPow = Console.ReadLine();
enemyMaxhp = 15;
enemyhp = enemyMaxhp;
hheroPow = Convert.ToInt32(heroPow);
enemyhp = enemyhp - hheroPow;
if (enemyhp > 0)
{
Console.WriteLine("{0}의 공격으로 {1}의 hp가 {2}/{3} 남았습니다.", hero , enemy , enemyhp, enemyMaxhp);
}
else if (enemyhp < 0)
{
enemyhp = 0;
Console.WriteLine("{0}의 공격으로 {1}에게 {4}의 데미지가 hp에 들어가 적의 피가 {2}/{3} 남았습니다.", hero, enemy, enemyhp, enemyMaxhp, hheroPow);
Console.WriteLine("{0}의 공격으로 {1}의 죽었습니다.", hero, enemy, enemyhp, enemyMaxhp);
}
}
}
}
'C# > 수업 과제' 카테고리의 다른 글
메뉴 고르기 과제 (메서드) (0) | 2023.01.03 |
---|---|
물약사용하기 과제 (메서드 for문 활용) (0) | 2023.01.03 |
C# 2023.1.1 아이템 기능 상세 출력 과제 (갓 오브 워 1) (0) | 2023.01.01 |
C# 2023.1.1 아이템 기능 상세 출력 과제 (파이널 판타지14 1) (0) | 2023.01.01 |
C# 2023.1.1 아이템 기능 상세 출력 과제 (리니지 1) (0) | 2023.01.01 |