diff options
Diffstat (limited to 'cpp01/ex00/Pony.cpp')
| -rw-r--r-- | cpp01/ex00/Pony.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/cpp01/ex00/Pony.cpp b/cpp01/ex00/Pony.cpp index 61f3b47..b45f0e1 100644 --- a/cpp01/ex00/Pony.cpp +++ b/cpp01/ex00/Pony.cpp @@ -6,27 +6,28 @@ /* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/13 09:06:06 by charles #+# #+# */ -/* Updated: 2020/04/13 09:06:11 by charles ### ########.fr */ +/* Updated: 2020/04/13 09:33:59 by charles ### ########.fr */ /* */ /* ************************************************************************** */ #include <iostream> #include "Pony.hpp" -Pony::Pony(int w, int s) +Pony::Pony(int weight, int maxSpeed) + : m_weight(weight), m_maxSpeed(maxSpeed) { - weight = w; - max_speed = s; } -void Pony::say_hello() +void Pony::sayHello() { - std::cout << "Hi, I'm a pony, I weight " << weight - << " and my speed limit is " << max_speed << std::endl; + std::cout << "Hi, I'm a pony, I weight " << m_weight + << " and my speed limit is " << m_maxSpeed + << std::endl; } void Pony::run() { - for (int i = 0; i < max_speed; i++) - std::cout << "I'm running really fast at " << i << ", look at me!" << std::endl; + for (int i = 0; i <= m_maxSpeed; i += m_maxSpeed / 10) + std::cout << "I'm running really fast at " << i + << ", look at me!" << std::endl; } |
