x003.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "xunits.h"
4 #include <iomanip>
5 #include <iostream>
6 
7 namespace nmx::apps::x003 {
8 
13 void ex3() {
14  std::cout << std::setprecision(2) << std::scientific;
15  const auto g = 9.81;
16  // Aufgabe (1)
17  auto volume = 5._cm * 3._cm * 2._cm;
18  auto mass = 50.0_g;
19  auto density = mass / volume;
20  std::cout << "V=" << volume << std::endl;
21  std::cout << "d=" << density << std::endl;
22  // Aufgabe (2)
23  std::cout << "v=" << 36.0_km / 1._h << std::endl;
24  // Aufgabe (3)
25  auto period = 2 * M_PI * sqrt(30.0_cm / g);
26  std::cout << "period=" << period << std::endl;
27  //Aufgabe(4)
28  auto frequency = 9000 / 1.0_min;
29  std::cout << "f=" << frequency << std::endl;
30 }
31 
32 } // namespace nmx::apps::x003
void ex3()
ex3 Umrechnung von Einheiten mithilfe von benutzerdefinierten Literalen
Definition: x003.h:13