Describe 데블스캠프2010/다섯째날/ObjectCraft/미션1/박재홍 here
zerg.c ¶
#include <stdio.h> struct zergling{ int attack; int defense; int HP; }; int main() { int dam1,dam2=0; struct zergling a; struct zergling b; a.attack=5; a.defense=0; a.HP=50; b.attack=5; b.defense=0; b.HP=50; dam1=a.attack-b.defense; dam2=b.attack-a.defense; while(a.HP>0) { a.HP-=dam1; printf("저글링 b가 저글링 a에게 데미지 %d를 입혀 HP가 %d가 되었습니다.\n",dam1,a.HP); } printf("저글링 a가 죽었습니다.\n"); return 0; }