add: ex02
This commit is contained in:
		| @ -1,15 +1,17 @@ | ||||
| #include "Zombie.hpp" | ||||
| #include <cstddef> | ||||
|  | ||||
| int main() | ||||
| { | ||||
| 	Zombie* jean = zombieHorde(2, "jean"); | ||||
| 	delete[] jean; | ||||
| 	 | ||||
| 	Zombie* bob = zombieHorde(-1, "bob"); | ||||
| 	if (bob == NULL) | ||||
| 		return 1; | ||||
| 	bob->announe(); | ||||
| 	Zombie* bob = zombieHorde(4, "bob"); | ||||
| 	for (size_t i = 0; i < 4; i++) | ||||
| 		bob[i].announe(); | ||||
| 	delete[] bob; | ||||
|  | ||||
| 	Zombie* pierre = zombieHorde(-1, "pierre"); | ||||
| 	if (pierre == NULL) | ||||
| 		return 1; | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| @ -7,9 +7,6 @@ Zombie* zombieHorde(int N, std::string name) | ||||
| 		return NULL; | ||||
| 	Zombie* zombies = new Zombie[N]; | ||||
| 	for (int i = 0; i < N; i++) | ||||
| 	{ | ||||
| 		zombies[i].setName(name); | ||||
| 		zombies[i].announe(); | ||||
| 	} | ||||
| 	return zombies; | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user