mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-03 04:14:27 +02:00
feat(example): si_constants
example added
This commit is contained in:
@@ -37,6 +37,7 @@ add_example(conversion_factor mp-units::core-fmt mp-units::core-io mp-units::si)
|
||||
add_example(custom_systems mp-units::core-io mp-units::si)
|
||||
add_example(hello_units mp-units::core-fmt mp-units::core-io mp-units::si mp-units::si-international)
|
||||
add_example(measurement mp-units::core-io mp-units::si)
|
||||
add_example(si_constants mp-units::core-fmt mp-units::si)
|
||||
|
||||
if(NOT ${projectPrefix}LIBCXX)
|
||||
add_subdirectory(glide_computer)
|
||||
|
40
example/si_constants.cpp
Normal file
40
example/si_constants.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
// The MIT License (MIT)
|
||||
//
|
||||
// Copyright (c) 2018 Mateusz Pusz
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include <units/format.h>
|
||||
#include <units/isq/si/constants.h>
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace units::isq::si::si2019;
|
||||
|
||||
std::cout << "The seven defining constants of the SI and the seven corresponding units they define:\n";
|
||||
std::cout << STD_FMT::format("- hyperfine transition frequency of Cs: {:%.0Q %q}\n",
|
||||
hyperfine_structure_transition_frequency<>);
|
||||
std::cout << STD_FMT::format("- speed of light in vacuum: {:%.0Q %q}\n", speed_of_light<>);
|
||||
std::cout << STD_FMT::format("- Planck constant: {}\n", planck_constant<>);
|
||||
std::cout << STD_FMT::format("- elementary charge: {}\n", elementary_charge<>);
|
||||
std::cout << STD_FMT::format("- Boltzmann constant: {}\n", boltzmann_constant<>);
|
||||
std::cout << STD_FMT::format("- Avogadro constant: {}\n", avogadro_constant<>);
|
||||
std::cout << STD_FMT::format("- luminous efficacy: {}\n", luminous_efficacy<>);
|
||||
}
|
Reference in New Issue
Block a user