diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-04-13 10:33:05 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-04-13 10:33:05 +0200 |
| commit | 0f3240844dbd5a874e1565a988ef355ededab6a5 (patch) | |
| tree | efc1a1307863d173be17a12fbab6b84fe7d00960 /cpp01/ex00/Pony.cpp | |
| parent | 629d52b1262879a346e9ca17567a8f483c60ba0a (diff) | |
| download | piscine_cpp-0f3240844dbd5a874e1565a988ef355ededab6a5.tar.gz piscine_cpp-0f3240844dbd5a874e1565a988ef355ededab6a5.tar.bz2 piscine_cpp-0f3240844dbd5a874e1565a988ef355ededab6a5.zip | |
Fixing cpp01
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; } |
