U E D R , A S I H C RSS

데블스캠프2010/다섯째날/ObjectCraft/미션2/박재홍 (rev. 1.1)

데블스캠프2010/다섯째날/Object Craft/미션2/박재홍

Describe 데블스캠프2010/다섯째날/ObjectCraft/미션2/박재홍 here

zerg2.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 && b.HP>0)
	{
		
		a.HP-=dam1;
		b.HP-=dam2;
		printf("저글링  b가 저글링 a에게 데미지 %d를 입혀 HP가 %d가 되었습니다.\n",dam1,a.HP);
		if(a.HP==0)
			break;
		printf("저글링  a가 저글링 b에게 데미지 %d를 입혀 HP가 %d가 되었습니다.\n",dam2,b.HP);

		


	}

	printf("저글링 a가 죽었습니다.\n");

	return 0;
		

}

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:10
Processing time 0.0188 sec