triangles.cpp - File triangles.cpp Created by Ahmad Isyraf...

This preview shows page 1 - 2 out of 4 pages.

/*File: triangles.cppCreated by: Ahmad Isyraf Imrani Mohd Zakil Hussin (ID: mohdz)Creation Date: November 30 2015Synopsis: */#include <iostream>#include <cmath>using namespace std;class Point{private:double px;double py;public:void setX(const double x);void setY(const double y);double getX() const;double getY() const;};class Triangle{private:Point blPoint;double length, height;public:// member functionsvoid setBottomLeftX(const double x);void setBottomLeftY(const double y);void setLength(const double inLength);void setHeight(const double inHeight);Point getBottomLeft() const;Point getBottomRight() const;Point getTopLeft() const;double getLength() const;double getHeight() const;double perimeter() const;double hypotenuse() const;void scaleLength(const double sx);void scaleHeight(const double sy);void display() const;};// FUNCTION PROTOTYPES GO HERE:void read_triangle(Triangle & tri);int main(){// Define local variablesTriangle tri;double sx, sy;//Prompt the user for triangle information and fill Class Triangle object,tri,//with this informationread_triangle(tri);

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture