temperature
Temperature units in imperial and SI units
You're viewing an older version of this page (#694). View the current version.
Interface
#include <codecogs/units/convert/temperature.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) |
| Temperature | ||||
| Celsius | deg C | C | unit_C | 1 |
| Fahrenheit | deg F | F | unit_F | 1.8 |
| Kelvin | deg K | K | unit_K | 1 |
FUNCTION
temperature
Converts a numbers from one temperature unit to another.
Example 1
#include <iostream>
#include <codecogs/units/convert/temperature.h>
using namespace Units::Convert;
int main()
{
std::cout << "temperature(37,unit_C, unit_K)=" << temperature(37,unit_C, unit_K);
return 0;
}Output:
temperature(37,unit_C, unit_K)= 98.6Parameters
number
the value in from_unit 's to convert
from_unit
an enumerated value of the initial temperature type
to_unit
an emuerated value of the output temperature 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.