correct cpp00

This commit is contained in:
Alexandre POMMIER 2022-07-23 11:58:33 +02:00
parent 22c98ea257
commit 8543b33348
12 changed files with 54 additions and 33 deletions

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/15 10:37:15 by apommier #+# #+# */
/* Updated: 2022/07/21 09:55:59 by apommier ### ########.fr */
/* Updated: 2022/07/22 12:57:52 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -32,7 +32,6 @@ class Contact {
private:
std::string _first_name;
std::string _last_name;
std::string _nickname;

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/15 10:37:24 by apommier #+# #+# */
/* Updated: 2022/07/22 12:32:50 by apommier ### ########.fr */
/* Updated: 2022/07/22 12:57:45 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -24,7 +24,6 @@ class PhoneBook {
void StoreContact(Contact *NewContact);
void PrintContact(int index);
void PrintIndex();
//void deleteContact();
private:

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/08 16:30:22 by apommier #+# #+# */
/* Updated: 2022/06/10 13:22:55 by apommier ### ########.fr */
/* Updated: 2022/07/22 12:57:34 by apommier ### ########.fr */
/* */
/* ************************************************************************** */

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/08 16:30:06 by apommier #+# #+# */
/* Updated: 2022/06/10 13:20:28 by apommier ### ########.fr */
/* Updated: 2022/07/22 13:01:54 by apommier ### ########.fr */
/* */
/* ************************************************************************** */

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/08 16:30:16 by apommier #+# #+# */
/* Updated: 2022/06/10 12:34:21 by apommier ### ########.fr */
/* Updated: 2022/07/22 12:58:18 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -17,6 +17,5 @@ Zombie *newZombie(std::string name)
Zombie *newZombie;
newZombie = new Zombie(name);
//newZombie->announce();
return (newZombie);
}

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/08 16:30:17 by apommier #+# #+# */
/* Updated: 2022/06/10 12:41:50 by apommier ### ########.fr */
/* Updated: 2022/07/22 12:58:36 by apommier ### ########.fr */
/* */
/* ************************************************************************** */

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/08 16:30:06 by apommier #+# #+# */
/* Updated: 2022/06/10 14:05:05 by apommier ### ########.fr */
/* Updated: 2022/07/22 13:14:47 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -19,6 +19,22 @@ int main()
std::cout << "--Zombie Horde--" << std::endl;
Horde = zombieHorde(nbZombie, "Bob");
for (int i = 0; i < nbZombie; i++)
{
std::cout << i << " ";
Horde[i].announce();
}
delete[] Horde;
nbZombie = 20;
std::cout << std::endl << "--Zombie Horde2--" << std::endl;
Horde = zombieHorde(nbZombie, "Bob2");
for (int i = 0; i < nbZombie; i++)
{
std::cout << i << " ";
Horde[i].announce();
}
delete[] Horde;
return (0);
}

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/10 13:44:22 by apommier #+# #+# */
/* Updated: 2022/06/10 13:57:30 by apommier ### ########.fr */
/* Updated: 2022/07/22 13:10:33 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,9 +18,6 @@ Zombie *zombieHorde(int N, std::string name)
Horde = new Zombie[N];
while (N--)
{
Horde[N].setName(name);
//Horde[N].announce();
}
return (Horde);
}

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/22 00:58:04 by apommier #+# #+# */
/* Updated: 2022/06/22 15:28:59 by apommier ### ########.fr */
/* Updated: 2022/07/22 13:23:40 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -40,3 +40,11 @@ void Fixed::setRawBits(int const raw)
std::cout << "setRawBits member function called\n";
this->_value = raw;
}
Fixed & Fixed::operator=(const Fixed& op)
{
std::cout << "Assignation operator called" << std::endl;
if (this != &op)
this->_value = op.getRawBits();
return (*this);
}

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/22 00:58:18 by apommier #+# #+# */
/* Updated: 2022/06/22 15:25:06 by apommier ### ########.fr */
/* Updated: 2022/07/22 13:23:04 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -31,4 +31,6 @@ class Fixed {
const static int _fraction = 8;
};
std::ostream &operator<<(std::ostream &out, const Fixed &nbr);
#endif

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/22 15:31:03 by apommier #+# #+# */
/* Updated: 2022/07/18 14:44:52 by apommier ### ########.fr */
/* Updated: 2022/07/22 13:36:04 by apommier ### ########.fr */
/* */
/* ************************************************************************** */

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/22 15:31:09 by apommier #+# #+# */
/* Updated: 2022/07/13 03:54:43 by apommier ### ########.fr */
/* Updated: 2022/07/22 13:29:02 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -20,26 +20,27 @@ int main( void )
float test = a.getRawBits();
std::cout << test << std::endl;
std::cout << "1--" << std::endl;
std::cout << "--1--" << std::endl;
std::cout << ++test << std::endl;
std::cout << "2--" << std::endl;
std::cout << "--2--" << std::endl;
std::cout << test << std::endl;
std::cout << "3--" << std::endl;
std::cout << "--3--" << std::endl;
std::cout << test++ << std::endl;
std::cout << "4--" << std::endl;
std::cout << "--4--" << std::endl;
std::cout << test << std::endl;
std::cout << "5--" << std::endl;
std::cout << "--5--" << std::endl;
std::cout << "--0--" << std::endl;
std::cout << a << std::endl;
std::cout << "1" << std::endl;
std::cout << "--1--" << std::endl;
std::cout << ++a << std::endl;
std::cout << "2" << std::endl;
std::cout << "--2--" << std::endl;
std::cout << a << std::endl;
std::cout << "3" << std::endl;
std::cout << "--3--" << std::endl;
std::cout << a++ << std::endl;
std::cout << "4" << std::endl;
std::cout << "--4--" << std::endl;
std::cout << a << std::endl;
std::cout << "5" << std::endl;
std::cout << "--5--" << std::endl;
std::cout << b << std::endl;