density
Density units, including imperial and SI units
Controller: will
Interface
C++
Density
doubledensity( | double | number | |
units | from_unit | ||
units | to_unit | ) |
Example 1
#include <iostream> #include <codecogs/units/convert/density.h> using namespace Units::Convert; int main() { std::cout << "density(10.2,unit_g_m3, unit_lb_in3)=" << density(1500000,unit_g_m3, unit_lb_in3); return 0; }
Output:density(1500000,unit_g_m3, unit_lb_in3)= 0.054190938
Note
- Conversion between incompatible types will throw an error
Parameters
number the value in from_unit 's to convert from_unit an enumerated value of the initial density type to_unit an emuerated value of the output density type
Returns
- the value in the converted unit.
Authors
- will
Source Code
Source code is available when you buy a Commercial licence.
Not a member, then Register with CodeCogs. Already a Member, then Login.
Other Documentation
The standard measurement units are:Unit names | Alternate names / spellings | Abbreviation | Enumeration Code | Conversion Rate (relative to first unit) |
Density | ||||
Grams/Meter3 | Grams/Metre3 | g/cu m | unit_g_m3 | 1 |
Ounces/Gallon | Ounce/Gallon | Oz/gal | unit_Oz_gal | 0.000133526 |
Pounds/Foot3 | Pounds/Feet3 | lb/cu ft | unit_lb_ft3 | 6.24E-05 |
Pounds/Inch3 | Pound/Inch3 | lb/cu in | unit_lb_in3 | 3.61E-08 |
Tons/Yard3 | Tonne/Yard3 | T/cu yd | unit_T_yd3 | 1.44E-06 |
Source Code
Source code is available when you buy a Commercial licence.
Not a member, then Register with CodeCogs. Already a Member, then Login.