aboutsummaryrefslogtreecommitdiffstats
path: root/ee1301/wk6/lab5/Bug.hpp
diff options
context:
space:
mode:
authorMatthew Strapp <msattr@gmail.com>2019-04-17 17:00:57 -0500
committerMatthew Strapp <msattr@gmail.com>2019-04-17 17:00:57 -0500
commit7bd0457ece5cfea5e17d6f2ac04508daefc6e4e3 (patch)
treeb6cc5690621a08af346d80680edc882bb3631ace /ee1301/wk6/lab5/Bug.hpp
parentfinish up (diff)
downloadhomework-7bd0457ece5cfea5e17d6f2ac04508daefc6e4e3.tar
homework-7bd0457ece5cfea5e17d6f2ac04508daefc6e4e3.tar.gz
homework-7bd0457ece5cfea5e17d6f2ac04508daefc6e4e3.tar.bz2
homework-7bd0457ece5cfea5e17d6f2ac04508daefc6e4e3.tar.lz
homework-7bd0457ece5cfea5e17d6f2ac04508daefc6e4e3.tar.xz
homework-7bd0457ece5cfea5e17d6f2ac04508daefc6e4e3.tar.zst
homework-7bd0457ece5cfea5e17d6f2ac04508daefc6e4e3.zip
LAB TIME
OH NO
Diffstat (limited to '')
-rw-r--r--ee1301/wk6/lab5/Bug.hpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/ee1301/wk6/lab5/Bug.hpp b/ee1301/wk6/lab5/Bug.hpp
new file mode 100644
index 0000000..f3bfae1
--- /dev/null
+++ b/ee1301/wk6/lab5/Bug.hpp
@@ -0,0 +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