diff options
Diffstat (limited to '')
-rw-r--r-- | ee1301/wk6/lab5/Bug.hpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/ee1301/wk6/lab5/Bug.hpp b/ee1301/wk6/lab5/Bug.hpp index f3bfae1..cc704ab 100644 --- a/ee1301/wk6/lab5/Bug.hpp +++ b/ee1301/wk6/lab5/Bug.hpp @@ -1,28 +1,28 @@ -#include <iostream> - -#ifndef BUG_H - -#define BUG_H -class Bug { -private: - int position, dir; -public: - Bug() { - position=0; - dir=1; - } - Bug(int pos) { - position=pos; - dir=1; - } - void move() { - position+=dir; - } - void turn() { - dir*=-1; - } - void display() { - std::cout << "position = " << position << ", direction = " << dir << std::endl; - } -}; -#endif +#include <iostream>
+
+#ifndef BUG_H
+
+#define BUG_H
+class Bug {
+private:
+ int position, dir;
+public:
+ Bug() {
+ position=0;
+ dir=1;
+ }
+ Bug(int pos) {
+ position=pos;
+ dir=1;
+ }
+ void move() {
+ position+=dir;
+ }
+ void turn() {
+ dir*=-1;
+ }
+ void display() {
+ std::cout << "position = " << position << ", direction = " << dir << std::endl;
+ }
+};
+#endif
|