#ifndef triangle_h #define triangle_h #include #include #include "shape.h" double triangleArea(Shape* triangle) { double side = triangle->perimeter / 3; double area = (sqrt(3) / 4) * (side * side); return area; } Shape* newTriangle(double perimeter) { Shape* triangle = malloc(sizeof(Shape)); triangle->numSides = 4; triangle->perimeter = perimeter; triangle->area = triangleArea; return triangle; } #endif