#include <codecogs/geometry/area/right_triangle.h>
using namespace Geometry::Area;
| double | right_triangle (double a, double b, double c, double h)[inline] Computes the area of a trapezium within a right angled triangle with a fixed edge. | |
| Real | cc_right_triangle (Real a, Real b, Real c, Real h) This function is available as a Microsoft Excel add-in. |
| doubleright_triangle( | double | a | |
| double | b | ||
| double | c | ||
| double | h | )[inline] |

#include <codecogs/geometry/area/right_triangle.h> #include <stdio.h> int main() { // the lengths of the sides double a = 3.0, b = 4.0, c = 5.0; // display the lengths of the sides printf("a = %.1lf\nb = %.1lf\nc = %.1lf\n\n", a, b, c); // display the area for different values of h for (double h = 0.1; h < 1.09; h += 0.1) printf("h = %.1lf Area = %.2lf\n", h, Geometry::Area::right_triangle(a, b, c, h)); return 0; }
a = 3.0 b = 4.0 c = 5.0 h = 0.1 Area = 0.30 h = 0.2 Area = 0.59 h = 0.3 Area = 0.87 h = 0.4 Area = 1.14 h = 0.5 Area = 1.41 h = 0.6 Area = 1.66 h = 0.7 Area = 1.92 h = 0.8 Area = 2.16 h = 0.9 Area = 2.40 h = 1.0 Area = 2.62
| a | first side of the triangle (BC) |
| b | second side of the triangle (AC) |
| c | third side of the triangle (AB) |
| h | the distance between line |