diff options
author | zedarider <ymherklotz@gmail.com> | 2016-12-03 13:20:25 +0000 |
---|---|---|
committer | zedarider <ymherklotz@gmail.com> | 2016-12-03 13:20:25 +0000 |
commit | 5c3a1832e6d469b867fc8921ff397a8f51d4a2f7 (patch) | |
tree | 2b8e2cb6ed66cb757d2ffef64824581b901d6950 | |
parent | 847ba8cd95371349df458f8029637064d5ddb892 (diff) | |
download | second-year-computing-master.tar.gz second-year-computing-master.zip |
-rwxr-xr-x | Lab Assessment/bin/lab_assessment | bin | 72568 -> 72568 bytes | |||
-rw-r--r-- | Lab Assessment/circles.txt | 5 | ||||
-rw-r--r-- | Lab Assessment/include/shape.hpp | 2 | ||||
-rw-r--r-- | Lab Assessment/src/main.cpp | 12 | ||||
-rw-r--r-- | Lab Assessment/triangles.txt | 2 |
5 files changed, 14 insertions, 7 deletions
diff --git a/Lab Assessment/bin/lab_assessment b/Lab Assessment/bin/lab_assessment Binary files differindex d86da0a..d0ece3a 100755 --- a/Lab Assessment/bin/lab_assessment +++ b/Lab Assessment/bin/lab_assessment diff --git a/Lab Assessment/circles.txt b/Lab Assessment/circles.txt index 5866207..bc9253c 100644 --- a/Lab Assessment/circles.txt +++ b/Lab Assessment/circles.txt @@ -1,2 +1,7 @@ -2 1.5 10 2 -1 5.3 +1 -3 2 +5 3 4 +1 2 9 +2 4 2 +-1 4 4.31 diff --git a/Lab Assessment/include/shape.hpp b/Lab Assessment/include/shape.hpp index 34aedca..b19a448 100644 --- a/Lab Assessment/include/shape.hpp +++ b/Lab Assessment/include/shape.hpp @@ -60,7 +60,7 @@ public: double get_perimeter(); private: - const double PI = 3.14; + const double PI = 3.14159265; Point centre; double radius; }; diff --git a/Lab Assessment/src/main.cpp b/Lab Assessment/src/main.cpp index 6b3537c..d5a4cd1 100644 --- a/Lab Assessment/src/main.cpp +++ b/Lab Assessment/src/main.cpp @@ -17,6 +17,8 @@ int main(int argc, char* argv[]) { double x_tmp[3], y_tmp[3]; // radius of circle double radius_tmp; + // shape pointer added to the vector + shape_ptr shape_tmp; // lists in which the triangles and circles are stored list<Triangle> triangle_list; @@ -83,15 +85,13 @@ int main(int argc, char* argv[]) { // adding Triangles and Circles to vector of Shapes for(list<Triangle>::iterator it = triangle_list.begin(); it != triangle_list.end(); ++it) { - shape_ptr tmp; - tmp = &*it; - shape_vector.push_back(tmp); + shape_tmp = &*it; + shape_vector.push_back(shape_tmp); } for(list<Circle>::iterator it = circle_list.begin(); it != circle_list.end(); ++it) { - shape_ptr tmp; - tmp = &*it; - shape_vector.push_back(tmp); + shape_tmp = &*it; + shape_vector.push_back(shape_tmp); } // printing perimeters for all shapes diff --git a/Lab Assessment/triangles.txt b/Lab Assessment/triangles.txt index ee1b334..10d2156 100644 --- a/Lab Assessment/triangles.txt +++ b/Lab Assessment/triangles.txt @@ -1,2 +1,4 @@ 1.5 2.5 3 3 2 2 -0.5 1.2 1 1 -1 1 +4 3 2 9 3 4 +3.2 1.9 2.4 3.9 0.2 1.2 |