Pure Programmer
Blue Matrix


Project: Physical Constants

Write a program that defines and prints the values for the following physical constants:

  • Speed of light in vacuum (c)
  • Planck constant (h)
  • Newton's gravitation constant (G)
  • Elementary charge (e)
  • Avogadro constant (L)
  • Boltzmann constant (k)

Use named constants for all values.

See: [[List of physical constants]]

Output
$ g++ -std=c++17 PhysicalConstants.cpp -o PhysicalConstants -lfmt $ ./PhysicalConstants c: 2.99792e+08 h: 6.62607e-34 G: 6.6743e-11 e: 1.60218e-19 L: 6.02214e+23 k: 1.38065e-23

Solution