Пример #1
0
Файл: main.cpp Проект: sdurr/CPP
int main( void )
{
	srand(time(NULL));

	std::string		name[10] = {
		"Stephanie",
		"Geoffroy",
		"Ezio",
		"Thomas",
		"Hubert",
		"Matthieu",
		"Stephane",
		"Clara",
		"Gregory",
		"Aurelien",
	};

	int				index = rand() % 10;
	ZombieEvent		one;
	Zombie*			test = one.newZombie(name[index]);

	index = rand() % 10;

	Zombie*			test1 = one.newZombie(name[index]);

	test->announce();
	one.setZombieType(test, "mangeur");
	test->announce();
	test1->announce();

	delete test;
	delete test1;

	return 0;
}
Пример #2
0
int		main(void)
{

	Zombie *	marvin;
	Zombie *	random;

	std::cout << "<Main> Creation of a zombie by default" << std::endl;
	Zombie	livingDead;
	livingDead.announce();

	std::cout << std::endl;
	ZombieEvent	event;

	std::cout << std::endl << "<Main> Adding a type to the existing zombie" << std::endl;
	event.setZombieType("Hungry");
	std::cout << "<Main> Checking the zombie type in the main : [" << event.getZombieType() << "]" << std::endl;
	std::cout << std::endl << "<Main> Creation of a zombie called Marvin" << std::endl;
	marvin = event.newZombie("Marvin");
	std::cout << "<Main> What is it zombie?" << std::endl;
	marvin->announce();
	std::cout << "<Main> Get away Marvin!" << std::endl;
	delete marvin;

	std::cout << std::endl << "<Main> Creation of a random zombie with type Hungry" << std::endl;
	random = event.randomChump();
	std::cout << "<Main> I will destroy you now" << std::endl;
	delete random;

	std::cout << "<Main> This is the end, computer always win." << std::endl;
	return (0);
}
Пример #3
0
void			wave(ZombieEvent &event, const char *type, int len)
{
	Zombie			*tmp;

	event.setZombieType(type);
	while (len-- > 0)
	{
		tmp = event.newZombie("LAAAL");
		tmp->announce();
		delete tmp;
	}
}
Пример #4
0
int		main(void)
{
	srand(time(0));
	ZombieEvent		eve = ZombieEvent();

	Zombie			*z1 = eve.randomChump();
	eve.setZombieType("SWAAAAAG");
	Zombie			*z2 = eve.randomChump();
	Zombie			*z3 = eve.randomChump();
	eve.setZombieType("Bobo Parisien");
	Zombie			*z4 = eve.randomChump();

	z1->announce();
	z2->announce();
	z4->announce();
	z3->announce();
	delete z1;
	delete z2;
	delete z3;
	delete z4;
	return (0);
}