|
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Implementations for the perimeter of various shapes. More...
#include <cassert>#include <cmath>#include <cstdint>#include <iostream>Namespaces | |
| namespace | math |
| for assert | |
Functions | |
| template<typename T > | |
| T | math::square_perimeter (T length) |
| perimeter of a square (4 * l) | |
| template<typename T > | |
| T | math::rect_perimeter (T length, T width) |
| perimeter of a rectangle ( 2(l + w) ) | |
| template<typename T > | |
| T | math::triangle_perimeter (T base, T height, T hypotenuse) |
| perimeter of a triangle (a + b + c) | |
| template<typename T > | |
| T | math::circle_perimeter (T radius) |
| perimeter of a circle (2 * pi * r) | |
| template<typename T > | |
| T | math::parallelogram_perimeter (T base, T height) |
| perimeter of a parallelogram 2(b + h) | |
| template<typename T > | |
| T | math::cube_surface_perimeter (T length) |
| surface perimeter of a cube ( 12 | |
| template<typename T > | |
| T | math::n_polygon_surface_perimeter (T sides, T length) |
| surface perimeter of a n-polygon ( n * l) | |
| template<typename T > | |
| T | math::cylinder_surface_perimeter (T radius, T height) |
| surface perimeter of a cylinder (2 * radius + 2 * height) | |
| static void | test () |
| Self-test implementations. | |
| int | main () |
| Main function. | |
Implementations for the perimeter of various shapes.
The of a shape is the amount of 2D space it takes up. All shapes have a formula for their perimeter. These implementations support multiple return types.
| int main | ( | void | ) |
|
static |
Self-test implementations.