Temperature units in imperial and SI units

View versions (1)

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
GPL Licence — free for non commercial use. See Licence details.

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.6

Parameters

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.