From 0f3240844dbd5a874e1565a988ef355ededab6a5 Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 13 Apr 2020 10:33:05 +0200 Subject: Fixing cpp01 --- cpp01/ex00/Pony.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'cpp01/ex00/Pony.cpp') 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 +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 #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; } -- cgit