|
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Implementations for the area of various shapes. More...
#include <cassert>#include <cmath>#include <cstdint>#include <iostream>Namespaces | |
| namespace | math |
| for std::rand | |
Functions | |
| template<typename T > | |
| T | math::square_area (T length) |
| area of a square (l * l) More... | |
| template<typename T > | |
| T | math::rect_area (T length, T width) |
| area of a rectangle (l * w) More... | |
| template<typename T > | |
| T | math::triangle_area (T base, T height) |
| area of a triangle (b * h / 2) More... | |
| template<typename T > | |
| T | math::circle_area (T radius) |
| area of a circle (pi More... | |
| template<typename T > | |
| T | math::parallelogram_area (T base, T height) |
| area of a parallelogram (b * h) More... | |
| template<typename T > | |
| T | math::cube_surface_area (T length) |
| surface area of a cube ( 6 * (l More... | |
| template<typename T > | |
| T | math::sphere_surface_area (T radius) |
| surface area of a sphere ( 4 * pi * r^2) More... | |
| template<typename T > | |
| T | math::cylinder_surface_area (T radius, T height) |
| surface area of a cylinder (2 * pi * r * h + 2 * pi * r^2) More... | |
| static void | test () |
| Self-test implementations. More... | |
| int | main () |
| Main function. More... | |
Implementations for the area of various shapes.
The area of a shape is the amount of 2D space it takes up. All shapes have a formula to get the area of any given shape. These implementations support multiple return types.
| int main | ( | void | ) |
|
static |
Self-test implementations.