volume
Volume units, including imperial and SI units
Interface
#include <codecogs/units/convert/volume.h>
using namespace Units::Convert;
Overview
The standard measurement units are:
| Unit names | Alternate names / spellings | Abbreviation | Enumeration Code | Conversion Rate (relative to first unit) |
| Volume | ||||
| Litres | Liters | l | unit_l | 1 |
| Inches3 | Inch3 | cu in | unit_in3 | 61.02374409 |
| Feet3 | foot3 | cu ft | unit_ft3 | 0.035314667 |
| Yards3 | Yard3 | cu yd | unit_yd3 | 0.001307951 |
| Cups | Cup | c | unit_c | 4.226752838 |
| Gallons (US) | Gallon (US) | gal (US) | unit_gal_us | 0.264172052 |
| Gallons (UK) | Gallon (UK) | gal (UK) | unit_gal_uk | 0.219969152 |
| Meters3 | Metre3 | cu m | unit_m3 | 0.001 |
| Ounces (US) | Ounce (US) | fl oz (US) | unit_fl_oz_us | 33.8140227 |
| Ounces (UK) | Ounce (UK) | fl oz (UK) | unit_fl_oz_uk | 35.19506424 |
| Pints | Pint | pt | unit_pt | 2.113376419 |
| Quarts | Quart | qt | unit_qt | 1.056688209 |
| Tablespoons | Tablespoon | tbsp | unit_tbsp | 67.6280454 |
| Teaspoons | Teaspoon | tsp | unit_tsp | 202.8841362 |
| Volume - Dry | ||||
| Litres (Dry) | Liters | l (Dry) | unit_l_dry | 1 |
| Barrels | Barrel | bbl | unit_bbl | 0.008648489 |
| Bushels (Dry) | Bushel (Dry) | bu | unit_bu | 0.028377592 |
| Pecks | Peck | pk | unit_pk | 0.113510368 |
| Pints (Dry) | Pint (Dry) | pt (Dry) | unit_pt_dry | 1.81616588 |
| Quarts (Dry) | Quart (Dry) | qt (Dry) | unit_qt_dry | 0.90808294 |
FUNCTION
volume
Converts a volume from one unit to another.
Example 1
#include <iostream>
#include <codecogs/units/convert/volume.h>
using namespace Units::Convert;
int main()
{
std::cout << "volume(10.2,unit_l, unit_m3)=" << volume(10.2,unit_l, unit_m3);
return 0;
}Output:
volume(10.2,unit_l, unit_m3)= 0.0102Parameters
number
the value in from_unit 's to convert
from_unit
an enumerated value of the initial volume type
to_unit
an emuerated value of the output volume type
Returns
the value in the converted unit.
This function's source code is only visible to registered users — documentation and the calculator above are free to use either way. Sign in to see it.