Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Implmentations for the volume of various 3D shapes. More...
#include <cassert>
#include <cmath>
#include <cstdint>
#include <iostream>
Namespaces | |
namespace | math |
for IO operations | |
Functions | |
template<typename T > | |
T | math::cube_volume (T length) |
The volume of a cube | |
template<typename T > | |
T | math::rect_prism_volume (T length, T width, T height) |
The volume of a rectangular prism. | |
template<typename T > | |
T | math::cone_volume (T radius, T height, double PI=3.14) |
The volume of a cone | |
template<typename T > | |
T | math::triangle_prism_volume (T base, T height, T depth) |
The volume of a triangular prism. | |
template<typename T > | |
T | math::pyramid_volume (T length, T width, T height) |
The volume of a pyramid | |
template<typename T > | |
T | math::sphere_volume (T radius, double PI=3.14) |
The volume of a sphere | |
template<typename T > | |
T | math::cylinder_volume (T radius, T height, double PI=3.14) |
The volume of a cylinder | |
static void | test () |
Self-test implementations. | |
int | main () |
Main function. | |
Implmentations for the volume of various 3D shapes.
The volume of a 3D shape is the amount of 3D space that the shape takes up. All shapes have a formula to get the volume of any given shape. These implementations support multiple return types.
int main | ( | void | ) |
|
static |
Self-test implementations.