area
Measurement units, including imperial and SI units
Interface
#include <codecogs/units/convert/area.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) |
| Area | ||||
| Meters2 | Metres2 | sq m | unit_m2 | 1 |
| Acres | acre | a | unit_a | 0.000247104 |
| Feet2 | foot2 | sq ft | unit_ft2 | 10.76391042 |
| Hectares | Hectare | ha | unit_ha | 0.0001 |
| Inches2 | Inch2 | sq in | unit_in2 | 1550.0031 |
| Miles2 | Mile2 | sq mi | unit_mi2 | 3.86E-07 |
| Yards2 | Yard2 | sq yd | unit_yd2 | 1.195990046 |
FUNCTION
area
Converts an area from one unit to another.
Example 1
#include <iostream>
#include <codecogs/units/convert/area.h>
using namespace Units::Convert;
int main()
{
std::cout << "area(10.2,unit_m2, unit_ha)=" << area(10.2,unit_m2, unit_ha);
return 0;
}Output:
area(10.2,unit_m2, unit_ha)= 0.00102Parameters
number
the value in from_unit 's to convert
from_unit
an enumerated value of the initial area type
to_unit
an emuerated value of the output area type
Returns
the value in the converted unit.
Conversion between incompatible types will throw an error
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.