From 5c3a1832e6d469b867fc8921ff397a8f51d4a2f7 Mon Sep 17 00:00:00 2001 From: zedarider Date: Sat, 3 Dec 2016 13:20:25 +0000 Subject: adding files --- Lab Assessment/bin/lab_assessment | Bin 72568 -> 72568 bytes Lab Assessment/circles.txt | 5 +++++ Lab Assessment/include/shape.hpp | 2 +- Lab Assessment/src/main.cpp | 12 ++++++------ 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 index d86da0a..d0ece3a 100755 Binary files a/Lab Assessment/bin/lab_assessment and b/Lab Assessment/bin/lab_assessment differ 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_list; @@ -83,15 +85,13 @@ int main(int argc, char* argv[]) { // adding Triangles and Circles to vector of Shapes for(list::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::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 -- cgit