Force units, including imperial and SI units

You're viewing an older version of this page (#685). View the current version.

View versions (1)

Interface

#include <codecogs/units/convert/force.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)
Force
Newtons Newton N unit_N 1
Gram Force Grams Force gf unit_gf 101.9716213
Joules/Centimeter Joules/Centimetre J/cm unit_J-cm 100
Joules/Meter Joules/Metre J/m unit_J-m 1
Ounce Force Ounces Force ozf unit_ozf 3.59694309
Pound Force Pounds Force lbf unit_lbf 0.224808943
GPL Licence — free for non commercial use. See Licence details.

FUNCTION

force

Converts a number from one force unit to another.

Example 1

#include <iostream>
#include <codecogs/units/convert/force.h>

using namespace Units::Convert;
int main()
{
  std::cout << "force(10.2,unit_N, unit_lbf)=" << convert(10.2,unit_N, unit_lbf);

  return 0;
}

Output:

force(10.2,unit_N, unit_lbf)= 2.29305121962

Parameters

number
the value in from_unit 's to convert
from_unit
an enumerated value of the initial force type
to_unit
an emuerated value of the output force type

Returns

the value in the converted unit.