x001.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <cmath>
4 #include <iomanip>
5 #include <iostream>
6 
7 namespace nmx::apps::x001 {
8 
13 inline void ex1() {
14  for (double x = -2; x <= 2; x++) {
15  //setze mit std::setw die Breite der Ausgabe
16  std::cout << std::setw(2) << x //
17  << std::setw(5) << std::pow(x, 2) //
18  << std::endl;
19  }
20 }
21 
26 inline void ex2() {
27  double x, y;
28  // erste Kathete
29  std::cout << "input x=?\t";
30  std::cin >> x;
31  // zweite Kathete
32  std::cout << "input y=?\t";
33  std::cin >> y;
34  //Berechnung und Ausgabe der Hypotenuse
35  std::cout << "output:" << sqrt(std::pow(x, 2) + std::pow(y, 2));
36 }
37 
41 inline void ex3() {
42  //Ort und Geschwindigkeit zum Zeitpunkt t=0
43  const double x0 = 0, v0 = 10;
44  for (double t = 0; t <= 5; t++) {
45  const double x = x0 + v0 * t;
46  std::cout << "t=" << t << " s" << std::setw(5) //
47  << "x=" << x << " m" << std::endl;
48  }
49 }
50 
51 } // namespace nmx::apps::x001
void ex2()
ex2 Berechnung der Hypotenuse eines rechtwinkligen Dreiecks Version 1.0
Definition: x001.h:26
void ex3()
ex3 Geradlinige Bewegung mit konstanter Geschwindigkeit
Definition: x001.h:41
void ex1()
ex1 Zahlen und ihre Quadrate werden in die Standardausgabe geschrieben
Definition: x001.h:13