U E D R , A S I H C RSS

데블스캠프2010/다섯째날/Object Craft/미션1/강소현

Describe 데블스캠프2010/다섯째날/ObjectCraft/미션1/강소현 here

test.cpp

#include <stdio.h>
typedef struct zergling{
	char *name;
	int attack;
	int protect;
	int HP;
}zerg;
void AAttackB(zerg *a, zerg *b){
	b->HP -= a->attack;
}
int main(){
	zerg zerg1={"저그1",5,0,50}, zerg2={"저그2",5,0,50};
	while(zerg2.HP > 0){
		AAttackB(&zerg1,&zerg2);
		printf("%s가 %s에게 데미지 %d를 입혀 HP가 %d가 되었다.\n",zerg1.name, zerg2.name, zerg1.attack, zerg2.HP);
	}
	puts("--------------------------------------------------");
	printf("%s의 HP가 %d가 되어 끝났음 ㅇㅇ\n",zerg2.name, zerg2.HP);
	return 0;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:10
Processing time 0.0070 sec