#include <stdio.h>
struct zergling{
int attack;
int defense;
int HP;
int no;
}a,b;
void setup(){
a.attack=5;
a.defense=0;
a.HP=50;
a.no=1;
b.attack=5;
b.defense=0;
b.HP=50;
b.no=2;
}
int get_damage(zergling a, zergling b){
return a.attack-b.defense;
}
void att(zergling & a, zergling &b){
int damage= get_damage(a,b);
b.HP-=damage;
printf("저글링 %d이 저글링 %d에게 데미지 %d를 입혀 HP가 %d가 되었습니다.\n",a.no,b.no,damage,b.HP);
}
int main()
{
setup();
while(1)
{
att(a,b);
if(b.HP==0){
printf("저글링 %d이 죽었습니다\n",b.no);
break;
}
att(b,a);
if(a.HP==0){
printf("저글링 %d가 죽었습니다\n",a.no);
break;
}
}
return 0;
}