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