From 24211173e3ca1fdf55378c8e96b56e91cd6a8d0a Mon Sep 17 00:00:00 2001
From: Peter Gerwinski <peter.gerwinski@hs-bochum.de>
Date: Wed, 3 May 2023 21:36:50 +0200
Subject: [PATCH] Notizen 20.4.2023: Stundenplan-Algorithmus; Beispiele
 27.4.2023

---
 20230420/ad-20230420.txt            | 31 +++++++++++
 20230427/exceptions-0.cpp           | 19 +++++++
 20230427/exceptions-1.cpp           | 21 ++++++++
 20230427/exceptions-10.cpp          | 42 +++++++++++++++
 20230427/exceptions-11.cpp          | 43 +++++++++++++++
 20230427/exceptions-1a.cpp          | 17 ++++++
 20230427/exceptions-1b.cpp          | 21 ++++++++
 20230427/exceptions-1c.cpp          | 19 +++++++
 20230427/exceptions-2.cpp           | 43 +++++++++++++++
 20230427/exceptions-2a.cpp          | 42 +++++++++++++++
 20230427/exceptions-2b.cpp          | 46 ++++++++++++++++
 20230427/exceptions-2c.cpp          | 45 ++++++++++++++++
 20230427/exceptions-3.cpp           | 42 +++++++++++++++
 20230427/exceptions-4.cpp           | 28 ++++++++++
 20230427/exceptions-5.cpp           | 33 ++++++++++++
 20230427/exceptions-6.cpp           | 33 ++++++++++++
 20230427/exceptions-7.cpp           | 38 +++++++++++++
 20230427/exceptions-8.cpp           | 38 +++++++++++++
 20230427/exceptions-9.cpp           | 39 ++++++++++++++
 20230427/exceptions-what.cpp        | 16 ++++++
 20230427/r-value-references-01.cpp  | 46 ++++++++++++++++
 20230427/r-value-references-02.cpp  | 54 +++++++++++++++++++
 20230427/r-value-references-03.cpp  | 57 ++++++++++++++++++++
 20230427/r-value-references-03a.cpp | 57 ++++++++++++++++++++
 20230427/r-value-references-04.cpp  | 54 +++++++++++++++++++
 20230427/r-value-references-04a.cpp | 54 +++++++++++++++++++
 20230427/r-value-references-05.cpp  | 60 +++++++++++++++++++++
 20230427/r-value-references-06.cpp  | 69 ++++++++++++++++++++++++
 20230427/r-value-references-07.cpp  | 69 ++++++++++++++++++++++++
 20230427/r-value-references-08.cpp  | 76 ++++++++++++++++++++++++++
 20230427/r-value-references-09.cpp  | 76 ++++++++++++++++++++++++++
 20230427/r-value-references-10.cpp  | 76 ++++++++++++++++++++++++++
 20230427/r-value-references-11.cpp  | 77 ++++++++++++++++++++++++++
 20230427/r-value-references-12.cpp  | 83 +++++++++++++++++++++++++++++
 20230427/type-conversions-01.cpp    | 11 ++++
 20230427/type-conversions-02.cpp    | 11 ++++
 20230427/type-conversions-03.cpp    | 24 +++++++++
 20230427/type-conversions-04.cpp    | 24 +++++++++
 20230427/type-conversions-05.cpp    | 25 +++++++++
 20230427/type-conversions-06.cpp    | 25 +++++++++
 20230427/type-conversions-07.cpp    | 25 +++++++++
 20230427/type-conversions-08.cpp    | 28 ++++++++++
 20230427/type-conversions-09.cpp    | 28 ++++++++++
 20230427/type-conversions-10.cpp    | 28 ++++++++++
 20230427/type-conversions-11.cpp    | 28 ++++++++++
 20230427/type-conversions-12.cpp    | 29 ++++++++++
 20230427/type-conversions-13.cpp    | 29 ++++++++++
 20230427/type-conversions-14.cpp    | 31 +++++++++++
 20230427/type-conversions-15.cpp    | 37 +++++++++++++
 20230427/type-conversions-16.cpp    | 37 +++++++++++++
 20230427/type-conversions-17.cpp    | 37 +++++++++++++
 20230427/type-conversions-18.cpp    | 41 ++++++++++++++
 20230427/type-conversions-19.cpp    | 41 ++++++++++++++
 20230427/type-conversions-20.cpp    |  9 ++++
 20230427/type-conversions-21.cpp    |  9 ++++
 20230427/type-conversions-22.cpp    |  9 ++++
 20230427/type-conversions-23.cpp    |  9 ++++
 20230427/type-conversions-24.cpp    |  9 ++++
 20230427/type-conversions-25.cpp    |  9 ++++
 59 files changed, 2157 insertions(+)
 create mode 100644 20230420/ad-20230420.txt
 create mode 100644 20230427/exceptions-0.cpp
 create mode 100644 20230427/exceptions-1.cpp
 create mode 100644 20230427/exceptions-10.cpp
 create mode 100644 20230427/exceptions-11.cpp
 create mode 100644 20230427/exceptions-1a.cpp
 create mode 100644 20230427/exceptions-1b.cpp
 create mode 100644 20230427/exceptions-1c.cpp
 create mode 100644 20230427/exceptions-2.cpp
 create mode 100644 20230427/exceptions-2a.cpp
 create mode 100644 20230427/exceptions-2b.cpp
 create mode 100644 20230427/exceptions-2c.cpp
 create mode 100644 20230427/exceptions-3.cpp
 create mode 100644 20230427/exceptions-4.cpp
 create mode 100644 20230427/exceptions-5.cpp
 create mode 100644 20230427/exceptions-6.cpp
 create mode 100644 20230427/exceptions-7.cpp
 create mode 100644 20230427/exceptions-8.cpp
 create mode 100644 20230427/exceptions-9.cpp
 create mode 100644 20230427/exceptions-what.cpp
 create mode 100644 20230427/r-value-references-01.cpp
 create mode 100644 20230427/r-value-references-02.cpp
 create mode 100644 20230427/r-value-references-03.cpp
 create mode 100644 20230427/r-value-references-03a.cpp
 create mode 100644 20230427/r-value-references-04.cpp
 create mode 100644 20230427/r-value-references-04a.cpp
 create mode 100644 20230427/r-value-references-05.cpp
 create mode 100644 20230427/r-value-references-06.cpp
 create mode 100644 20230427/r-value-references-07.cpp
 create mode 100644 20230427/r-value-references-08.cpp
 create mode 100644 20230427/r-value-references-09.cpp
 create mode 100644 20230427/r-value-references-10.cpp
 create mode 100644 20230427/r-value-references-11.cpp
 create mode 100644 20230427/r-value-references-12.cpp
 create mode 100644 20230427/type-conversions-01.cpp
 create mode 100644 20230427/type-conversions-02.cpp
 create mode 100644 20230427/type-conversions-03.cpp
 create mode 100644 20230427/type-conversions-04.cpp
 create mode 100644 20230427/type-conversions-05.cpp
 create mode 100644 20230427/type-conversions-06.cpp
 create mode 100644 20230427/type-conversions-07.cpp
 create mode 100644 20230427/type-conversions-08.cpp
 create mode 100644 20230427/type-conversions-09.cpp
 create mode 100644 20230427/type-conversions-10.cpp
 create mode 100644 20230427/type-conversions-11.cpp
 create mode 100644 20230427/type-conversions-12.cpp
 create mode 100644 20230427/type-conversions-13.cpp
 create mode 100644 20230427/type-conversions-14.cpp
 create mode 100644 20230427/type-conversions-15.cpp
 create mode 100644 20230427/type-conversions-16.cpp
 create mode 100644 20230427/type-conversions-17.cpp
 create mode 100644 20230427/type-conversions-18.cpp
 create mode 100644 20230427/type-conversions-19.cpp
 create mode 100644 20230427/type-conversions-20.cpp
 create mode 100644 20230427/type-conversions-21.cpp
 create mode 100644 20230427/type-conversions-22.cpp
 create mode 100644 20230427/type-conversions-23.cpp
 create mode 100644 20230427/type-conversions-24.cpp
 create mode 100644 20230427/type-conversions-25.cpp

diff --git a/20230420/ad-20230420.txt b/20230420/ad-20230420.txt
new file mode 100644
index 0000000..13fb67b
--- /dev/null
+++ b/20230420/ad-20230420.txt
@@ -0,0 +1,31 @@
+Stundenplan-Algorithmus, 20.04.2023, 17:27:42
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Zum Algorithmus von FET: https://lalescu.ro/liviu/fet/doc/en/generation-algorithm-description.html
+
+gegeben: Input
+ - Liste der Lehrveranstaltungen
+ - Liste der Studierendengruppen mit zeitlichen Einschränkungen
+ - Liste der Lehrenden mit zeitlichen Einschränkungen
+
+für jede Lehrveranstaltung:
+  Schritt 1: Nächstbesten freien Platz im Stundenplan wählen
+  Vorbedingungen: einige Lehrveranstaltungen wurden bereits plaziert
+  Dafür benötigt:
+   - Funktion, die auf Konflikte prüft: Bitmasken verwenden?
+   - Funktion, die den nächsten freien Slot findet
+  Schritt 2: Falls es keinen freien Platz gibt:
+   - irgendwas anderes wegschieben
+   - Was??? Wohin???
+
+--> Neue Idee
+
+  Falls es keinen freien Platz gibt:
+    Reihenfolge der "freifliegenden" Lehrveranstaltungen ändern
+    von vorne beginnen
+
+Stundenplan als Bitmaske:
+  4 * 11 + 1 = 45 Viertelstunden pro Tag an 5 Tagen pro Woche
+  = (4 * 11 + 1) * 5 = 225 Bit
+
+Bitmasken für Module berechnen.
+Mit dem Modul beginnen, das die wenigsten Möglichkeiten hat.
diff --git a/20230427/exceptions-0.cpp b/20230427/exceptions-0.cpp
new file mode 100644
index 0000000..6319e0e
--- /dev/null
+++ b/20230427/exceptions-0.cpp
@@ -0,0 +1,19 @@
+#include <iostream>
+
+using namespace std;
+
+int main ()
+{
+  int a = 42;
+  int b = 0;
+  if (b == 0)
+    {
+      cout << "Irgendwas ist schiefgelaufen: Ganzzahldivision durch Null" << endl;
+    }
+  else
+    {
+      int c = a / b;
+      cout << "c = " << c << endl;
+    }
+  return 0;
+}
diff --git a/20230427/exceptions-1.cpp b/20230427/exceptions-1.cpp
new file mode 100644
index 0000000..72db25a
--- /dev/null
+++ b/20230427/exceptions-1.cpp
@@ -0,0 +1,21 @@
+#include <iostream>
+
+using namespace std;
+
+int main ()
+{
+  try
+    {
+      int a = 42;
+      int b = 0;
+      if (b == 0)
+        throw "Ganzzahldivision durch Null";
+      int c = a / b;
+      cout << "c = " << c << endl;
+    }
+  catch (const char *msg)
+    {
+      cout << "Irgendwas ist schiefgelaufen: " << msg << endl;
+    }
+  return 0;
+}
diff --git a/20230427/exceptions-10.cpp b/20230427/exceptions-10.cpp
new file mode 100644
index 0000000..35ddd03
--- /dev/null
+++ b/20230427/exceptions-10.cpp
@@ -0,0 +1,42 @@
+#include <iostream>
+#include <sstream>
+
+using namespace std;
+
+class philosophy_exception: public exception
+{
+  int answer;
+  static const char *buffer;
+public:
+  philosophy_exception (int a) { answer = a; }
+  virtual const char *what () const noexcept;
+};
+
+const char *philosophy_exception::what () const noexcept
+{
+  return buffer;
+//  ostringstream buffer;
+//  buffer << "philosophy exception #" << answer;
+//  return buffer.str ().c_str ();
+}
+
+const char *philosophy_exception::buffer = "Marvin";
+
+int main ()
+{
+  int answer;
+  cout << "What's your answer? ";
+  cin >> answer;
+  try
+  {
+    if (answer == 42)
+      cout << "And what was the question?" << endl;
+    else
+      throw philosophy_exception (answer);
+  }
+  catch (exception &e)
+  {
+    cout << "caught exception: " << e.what () << endl;
+  }
+  return 0;
+}
diff --git a/20230427/exceptions-11.cpp b/20230427/exceptions-11.cpp
new file mode 100644
index 0000000..6188c39
--- /dev/null
+++ b/20230427/exceptions-11.cpp
@@ -0,0 +1,43 @@
+#include <iostream>
+#include <sstream>
+#include <string.h>
+
+using namespace std;
+
+class philosophy_exception: public exception
+{
+  int answer;
+  static char buffer[42];
+public:
+  philosophy_exception (int a) { answer = a; }
+  virtual const char *what () const noexcept;
+};
+
+const char *philosophy_exception::what () const noexcept
+{
+  ostringstream tmp_buffer;
+  tmp_buffer << "philosophy exception #" << answer;
+  strcpy (buffer, tmp_buffer.str ().c_str ());
+  return buffer;
+}
+
+char philosophy_exception::buffer[42] = "Marvin";
+
+int main ()
+{
+  int answer;
+  cout << "What's your answer? ";
+  cin >> answer;
+  try
+  {
+    if (answer == 42)
+      cout << "And what was the question?" << endl;
+    else
+      throw philosophy_exception (answer);
+  }
+  catch (exception &e)
+  {
+    cout << "caught exception: " << e.what () << endl;
+  }
+  return 0;
+}
diff --git a/20230427/exceptions-1a.cpp b/20230427/exceptions-1a.cpp
new file mode 100644
index 0000000..3666f51
--- /dev/null
+++ b/20230427/exceptions-1a.cpp
@@ -0,0 +1,17 @@
+#include <iostream>
+
+using namespace std;
+
+int main ()
+{
+  int a = 42;
+  int b = 0;
+  if (b == 0)
+    {
+      cout << "Irgendwas ist schiefgelaufen: " << "Ganzzahldivision durch Null" << endl;
+      return 1;
+    }
+  int c = a / b;
+  cout << "c = " << c << endl;
+  return 0;
+}
diff --git a/20230427/exceptions-1b.cpp b/20230427/exceptions-1b.cpp
new file mode 100644
index 0000000..d47f27d
--- /dev/null
+++ b/20230427/exceptions-1b.cpp
@@ -0,0 +1,21 @@
+#include <iostream>
+
+using namespace std;
+
+int main ()
+{
+  try
+    {
+      int a = 42;
+      int b = 0;
+      if (b == 0)
+        throw "Ganzzahldivision durch Null";
+      int c = a / b;
+      cout << "c = " << c << endl;
+    }
+  catch (int msg)
+    {
+      cout << "Irgendwas ist schiefgelaufen: " << msg << endl;
+    }
+  return 0;
+}
diff --git a/20230427/exceptions-1c.cpp b/20230427/exceptions-1c.cpp
new file mode 100644
index 0000000..3322800
--- /dev/null
+++ b/20230427/exceptions-1c.cpp
@@ -0,0 +1,19 @@
+#include <iostream>
+
+using namespace std;
+
+int main ()
+{
+  try
+    {
+      int a = 42;
+      int b = 0;
+      int c = a / b;
+      cout << "c = " << c << endl;
+    }
+  catch (int msg)
+    {
+      cout << "Irgendwas ist schiefgelaufen: " << msg << endl;
+    }
+  return 0;
+}
diff --git a/20230427/exceptions-2.cpp b/20230427/exceptions-2.cpp
new file mode 100644
index 0000000..fd78e31
--- /dev/null
+++ b/20230427/exceptions-2.cpp
@@ -0,0 +1,43 @@
+#include <iostream>
+
+using namespace std;
+
+void check_answer (int answer)
+{
+  if (answer != 42)
+    {
+      try
+      {
+        if (answer == 10)
+          throw answer;
+        else if (answer == 137)
+          throw "alpha";
+      }
+      catch (int e)
+      {
+        cout << "Yeah!" << endl;
+        throw;
+      }
+      throw "bullshit";
+    }
+}
+
+int main ()
+{
+  int answer;
+  cout << "What's your answer? ";
+  cin >> answer;
+  try
+  {
+    if (answer == 23)
+      throw answer;
+    else
+      check_answer (answer);
+  }
+  catch (const char *e)
+  {
+    cout << "caught string exception: " << e << endl;
+  }
+  cout << "And what was the question?" << endl;
+  return 0;
+}
diff --git a/20230427/exceptions-2a.cpp b/20230427/exceptions-2a.cpp
new file mode 100644
index 0000000..584107a
--- /dev/null
+++ b/20230427/exceptions-2a.cpp
@@ -0,0 +1,42 @@
+#include <iostream>
+
+using namespace std;
+
+void check_answer (int answer)
+{
+  if (answer != 42)
+    {
+      try
+      {
+        if (answer == 10)
+          throw answer;
+        if (answer == 137)
+          throw "alpha";
+      }
+      catch (int e)
+      {
+        cout << "Yeah!" << endl;
+        throw;
+      }
+      throw "bullshit";
+    }
+}
+
+int main ()
+{
+  int answer;
+  cout << "What's your answer? ";
+  cin >> answer;
+  try
+  {
+    if (answer == 23)
+      throw answer;
+    check_answer (answer);
+  }
+  catch (const char *e)
+  {
+    cout << "caught string exception: " << e << endl;
+  }
+  cout << "And what was the question?" << endl;
+  return 0;
+}
diff --git a/20230427/exceptions-2b.cpp b/20230427/exceptions-2b.cpp
new file mode 100644
index 0000000..7872f57
--- /dev/null
+++ b/20230427/exceptions-2b.cpp
@@ -0,0 +1,46 @@
+#include <iostream>
+
+using namespace std;
+
+void check_answer (int answer)
+{
+  if (answer != 42)
+    {
+      try
+      {
+        if (answer == 10)
+          throw answer;
+        if (answer == 137)
+          throw "alpha";
+      }
+      catch (int e)
+      {
+        cout << "Yeah!" << endl;
+        throw;
+      }
+      throw "bullshit";
+    }
+}
+
+int main ()
+{
+  int answer;
+  cout << "What's your answer? ";
+  cin >> answer;
+  try
+  {
+    if (answer == 23)
+      throw answer;
+    check_answer (answer);
+  }
+  catch (const char *e)
+  {
+    cout << "caught string exception: " << e << endl;
+  }
+  catch (int e)
+  {
+    cout << "caught integer exception: " << e << endl;
+  }
+  cout << "And what was the question?" << endl;
+  return 0;
+}
diff --git a/20230427/exceptions-2c.cpp b/20230427/exceptions-2c.cpp
new file mode 100644
index 0000000..3d16510
--- /dev/null
+++ b/20230427/exceptions-2c.cpp
@@ -0,0 +1,45 @@
+#include <iostream>
+
+using namespace std;
+
+void check_answer (int answer)
+{
+  if (answer == 42)
+    return;
+  try
+  {
+    if (answer == 10)
+      throw answer;
+    if (answer == 137)
+      throw "alpha";
+  }
+  catch (int e)
+  {
+    cout << "Yeah!" << endl;
+    throw;
+  }
+  throw "bullshit";
+}
+
+int main ()
+{
+  int answer;
+  cout << "What's your answer? ";
+  cin >> answer;
+  try
+  {
+    if (answer == 23)
+      throw answer;
+    check_answer (answer);
+  }
+  catch (const char *e)
+  {
+    cout << "caught string exception: " << e << endl;
+  }
+  catch (int e)
+  {
+    cout << "caught integer exception: " << e << endl;
+  }
+  cout << "And what was the question?" << endl;
+  return 0;
+}
diff --git a/20230427/exceptions-3.cpp b/20230427/exceptions-3.cpp
new file mode 100644
index 0000000..9e5941a
--- /dev/null
+++ b/20230427/exceptions-3.cpp
@@ -0,0 +1,42 @@
+#include <iostream>
+
+using namespace std;
+
+void check_answer (int answer)
+{
+  if (answer != 42)
+    {
+      try
+      {
+        if (answer == 10)
+          throw answer;
+        else if (answer == 137)
+          throw "alpha";
+      }
+      catch (int e)
+      {
+        cout << "Yeah!" << endl;
+      }
+      throw "bullshit";
+    }
+}
+
+int main ()
+{
+  int answer;
+  cout << "What's your answer? ";
+  cin >> answer;
+  try
+  {
+    if (answer == 23)
+      throw answer;
+    else
+      check_answer (answer);
+  }
+  catch (const char *e)
+  {
+    cout << "caught string exception: " << e << endl;
+  }
+  cout << "And what was the question?" << endl;
+  return 0;
+}
diff --git a/20230427/exceptions-4.cpp b/20230427/exceptions-4.cpp
new file mode 100644
index 0000000..a20e569
--- /dev/null
+++ b/20230427/exceptions-4.cpp
@@ -0,0 +1,28 @@
+#include <iostream>
+
+using namespace std;
+
+class philosophy_exception: public exception
+{
+  int answer;
+public:
+  philosophy_exception (int a) { answer = a; }
+};
+
+int main ()
+{
+  int answer;
+  cout << "What's your answer? ";
+  cin >> answer;
+  try
+  {
+    if (answer != 42)
+      throw philosophy_exception (answer);
+    cout << "And what was the question?" << endl;
+  }
+  catch (exception &e)
+  {
+    cout << "caught exception" << endl;
+  }
+  return 0;
+}
diff --git a/20230427/exceptions-5.cpp b/20230427/exceptions-5.cpp
new file mode 100644
index 0000000..f61ca5a
--- /dev/null
+++ b/20230427/exceptions-5.cpp
@@ -0,0 +1,33 @@
+#include <iostream>
+
+using namespace std;
+
+class philosophy_exception: public exception
+{
+  int answer;
+public:
+  philosophy_exception (int a) { answer = a; }
+  int get_answer () { return answer; }
+};
+
+int main ()
+{
+  int answer;
+  cout << "What's your answer? ";
+  cin >> answer;
+  try
+  {
+    if (answer != 42)
+      throw philosophy_exception (answer);
+    cout << "And what was the question?" << endl;
+  }
+  catch (philosophy_exception &e)
+  {
+    cout << "caught philosophy exception: " << e.get_answer () << endl;
+  }
+  catch (exception &e)
+  {
+    cout << "caught exception" << endl;
+  }
+  return 0;
+}
diff --git a/20230427/exceptions-6.cpp b/20230427/exceptions-6.cpp
new file mode 100644
index 0000000..326b7bc
--- /dev/null
+++ b/20230427/exceptions-6.cpp
@@ -0,0 +1,33 @@
+#include <iostream>
+
+using namespace std;
+
+class philosophy_exception: public exception
+{
+  int answer;
+public:
+  philosophy_exception (int a) { answer = a; }
+  int get_answer () { return answer; }
+};
+
+int main ()
+{
+  int answer;
+  cout << "What's your answer? ";
+  cin >> answer;
+  try
+  {
+    if (answer != 42)
+      throw philosophy_exception (answer);
+    cout << "And what was the question?" << endl;
+  }
+  catch (exception &e)
+  {
+    cout << "caught exception" << endl;
+  }
+  catch (philosophy_exception &e)
+  {
+    cout << "caught philosophy exception: " << e.get_answer () << endl;
+  }
+  return 0;
+}
diff --git a/20230427/exceptions-7.cpp b/20230427/exceptions-7.cpp
new file mode 100644
index 0000000..6a8cf00
--- /dev/null
+++ b/20230427/exceptions-7.cpp
@@ -0,0 +1,38 @@
+#include <iostream>
+#include <sstream>
+
+using namespace std;
+
+class philosophy_exception: public exception
+{
+  int answer;
+public:
+  philosophy_exception (int a) { answer = a; }
+  virtual const char *what ();
+};
+
+const char *philosophy_exception::what ()
+{
+  ostringstream buffer;
+  buffer << "philosophy exception #" << answer;
+  return buffer.str ().c_str ();
+}
+
+int main ()
+{
+  int answer;
+  cout << "What's your answer? ";
+  cin >> answer;
+  try
+  {
+    if (answer == 42)
+      cout << "And what was the question?" << endl;
+    else
+      throw philosophy_exception (answer);
+  }
+  catch (exception &e)
+  {
+    cout << "caught exception: " << e.what () << endl;
+  }
+  return 0;
+}
diff --git a/20230427/exceptions-8.cpp b/20230427/exceptions-8.cpp
new file mode 100644
index 0000000..bf3e05e
--- /dev/null
+++ b/20230427/exceptions-8.cpp
@@ -0,0 +1,38 @@
+#include <iostream>
+#include <sstream>
+
+using namespace std;
+
+class philosophy_exception: public exception
+{
+  int answer;
+public:
+  philosophy_exception (int a) { answer = a; }
+  virtual const char *what () const noexcept;
+};
+
+const char *philosophy_exception::what () const noexcept
+{
+  ostringstream buffer;
+  buffer << "philosophy exception #" << answer;
+  return buffer.str ().c_str ();
+}
+
+int main ()
+{
+  int answer;
+  cout << "What's your answer? ";
+  cin >> answer;
+  try
+  {
+    if (answer == 42)
+      cout << "And what was the question?" << endl;
+    else
+      throw philosophy_exception (answer);
+  }
+  catch (exception &e)
+  {
+    cout << "caught exception: " << e.what () << endl;
+  }
+  return 0;
+}
diff --git a/20230427/exceptions-9.cpp b/20230427/exceptions-9.cpp
new file mode 100644
index 0000000..0d0eca9
--- /dev/null
+++ b/20230427/exceptions-9.cpp
@@ -0,0 +1,39 @@
+#include <iostream>
+#include <sstream>
+
+using namespace std;
+
+class philosophy_exception: public exception
+{
+  int answer;
+public:
+  philosophy_exception (int a) { answer = a; }
+  virtual const char *what () const noexcept;
+};
+
+const char *philosophy_exception::what () const noexcept
+{
+  return "Marvin";
+//  ostringstream buffer;
+//  buffer << "philosophy exception #" << answer;
+//  return buffer.str ().c_str ();
+}
+
+int main ()
+{
+  int answer;
+  cout << "What's your answer? ";
+  cin >> answer;
+  try
+  {
+    if (answer == 42)
+      cout << "And what was the question?" << endl;
+    else
+      throw philosophy_exception (answer);
+  }
+  catch (exception &e)
+  {
+    cout << "caught exception: " << e.what () << endl;
+  }
+  return 0;
+}
diff --git a/20230427/exceptions-what.cpp b/20230427/exceptions-what.cpp
new file mode 100644
index 0000000..d575cf2
--- /dev/null
+++ b/20230427/exceptions-what.cpp
@@ -0,0 +1,16 @@
+// exception::what
+#include <iostream>       // std::cout
+#include <exception>      // std::exception
+
+struct ooops : std::exception {
+  virtual const char* what() const noexcept {return "Ooops!\n";}
+};
+
+int main () {
+  try {
+      throw ooops();
+  } catch (std::exception& ex) {
+      std::cout << ex.what();
+  }
+  return 0;
+}
diff --git a/20230427/r-value-references-01.cpp b/20230427/r-value-references-01.cpp
new file mode 100644
index 0000000..0be06b9
--- /dev/null
+++ b/20230427/r-value-references-01.cpp
@@ -0,0 +1,46 @@
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+class TComplicated
+{
+  string *content;
+
+public:
+  TComplicated ()
+  {
+    content = NULL;
+  }
+
+  TComplicated (const char *content)
+  {
+    this->content = new string (content);
+  }
+
+  ~TComplicated ()
+  {
+    cout << "~TComplicated (): content = ";
+    print ();
+    if (content)
+      delete content;
+    content = NULL;
+  }
+
+  void print ()
+  {
+    if (content)
+      cout << *content << endl;
+    else
+      cout << "(NULL)" << endl;
+  }
+};
+
+int main ()
+{
+  TComplicated c = "Hello, world!";
+  c.print ();
+  TComplicated d;
+  d.print ();
+  return 0;
+}
diff --git a/20230427/r-value-references-02.cpp b/20230427/r-value-references-02.cpp
new file mode 100644
index 0000000..5477fba
--- /dev/null
+++ b/20230427/r-value-references-02.cpp
@@ -0,0 +1,54 @@
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+class TComplicated
+{
+  string *content;
+
+public:
+  TComplicated ()
+  {
+    content = NULL;
+  }
+
+  TComplicated (const char *content)
+  {
+    this->content = new string (content);
+  }
+
+  TComplicated (const TComplicated &src)
+  {
+    if (src.content)
+      this->content = new string (*src.content);
+    else
+      this->content = NULL;
+  }
+
+  ~TComplicated ()
+  {
+    cout << "~TComplicated (): content = ";
+    print ();
+    if (content)
+      delete content;
+    content = NULL;
+  }
+
+  void print ()
+  {
+    if (content)
+      cout << *content << endl;
+    else
+      cout << "(NULL)" << endl;
+  }
+};
+
+int main ()
+{
+  TComplicated c = "Hello, world!";
+  c.print ();
+  TComplicated d = c;
+  d.print ();
+  return 0;
+}
diff --git a/20230427/r-value-references-03.cpp b/20230427/r-value-references-03.cpp
new file mode 100644
index 0000000..35be424
--- /dev/null
+++ b/20230427/r-value-references-03.cpp
@@ -0,0 +1,57 @@
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+class TComplicated
+{
+  string *content;
+
+public:
+  TComplicated ()
+  {
+    content = NULL;
+  }
+
+  TComplicated (const char *content)
+  {
+    this->content = new string (content);
+  }
+
+  TComplicated (const TComplicated &src)
+  {
+    if (src.content)
+      this->content = new string (*src.content);
+    else
+      this->content = NULL;
+  }
+
+  ~TComplicated ()
+  {
+    cout << "~TComplicated (): content = ";
+    print ();
+    if (content)
+      delete content;
+    content = NULL;
+  }
+
+  void print ()
+  {
+    if (content)
+      cout << *content << endl;
+    else
+      cout << "(NULL)" << endl;
+  }
+};
+
+void foo (TComplicated x)
+{
+  x.print ();
+}
+
+int main ()
+{
+  TComplicated c = "Hello, world!";
+  foo (c);
+  return 0;
+}
diff --git a/20230427/r-value-references-03a.cpp b/20230427/r-value-references-03a.cpp
new file mode 100644
index 0000000..4ad6e99
--- /dev/null
+++ b/20230427/r-value-references-03a.cpp
@@ -0,0 +1,57 @@
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+class TComplicated
+{
+  string *content;
+
+public:
+  TComplicated ()
+  {
+    content = NULL;
+  }
+
+  TComplicated (const char *content)
+  {
+    this->content = new string (content);
+  }
+
+  TComplicated (const TComplicated &src)
+  {
+    if (src.content)
+      this->content = new string (*src.content);
+    else
+      this->content = NULL;
+  }
+
+  ~TComplicated ()
+  {
+    cout << "~TComplicated (): content = ";
+    print ();
+    if (content)
+      delete content;
+    content = NULL;
+  }
+
+  void print ()
+  {
+    if (content)
+      cout << *content << endl;
+    else
+      cout << "(NULL)" << endl;
+  }
+};
+
+void foo (TComplicated &x)
+{
+  x.print ();
+}
+
+int main ()
+{
+  TComplicated c = "Hello, world!";
+  foo (c);
+  return 0;
+}
diff --git a/20230427/r-value-references-04.cpp b/20230427/r-value-references-04.cpp
new file mode 100644
index 0000000..e7b04d8
--- /dev/null
+++ b/20230427/r-value-references-04.cpp
@@ -0,0 +1,54 @@
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+class TComplicated
+{
+  string *content;
+
+public:
+  TComplicated ()
+  {
+    content = NULL;
+  }
+
+  TComplicated (const char *content)
+  {
+    this->content = new string (content);
+  }
+
+  TComplicated (const TComplicated &src)
+  {
+    if (src.content)
+      this->content = new string (*src.content);
+    else
+      this->content = NULL;
+  }
+
+  ~TComplicated ()
+  {
+    cout << "~TComplicated (): content = ";
+    print ();
+    if (content)
+      delete content;
+    content = NULL;
+  }
+
+  void print ()
+  {
+    if (content)
+      cout << *content << endl;
+    else
+      cout << "(NULL)" << endl;
+  }
+};
+
+int main ()
+{
+  TComplicated c = "Hello, world!";
+  c.print ();
+  TComplicated d = move (c);
+  d.print ();
+  return 0;
+}
diff --git a/20230427/r-value-references-04a.cpp b/20230427/r-value-references-04a.cpp
new file mode 100644
index 0000000..686fae7
--- /dev/null
+++ b/20230427/r-value-references-04a.cpp
@@ -0,0 +1,54 @@
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+class TComplicated
+{
+  string *content;
+
+public:
+  TComplicated ()
+  {
+    content = NULL;
+  }
+
+  TComplicated (const char *content)
+  {
+    this->content = new string (content);
+  }
+
+  TComplicated (const TComplicated &src)
+  {
+    if (src.content)
+      this->content = new string (*src.content);
+    else
+      this->content = NULL;
+  }
+
+  ~TComplicated ()
+  {
+    cout << "~TComplicated (): content = ";
+    print ();
+    if (content)
+      delete content;
+    content = NULL;
+  }
+
+  void print ()
+  {
+    if (content)
+      cout << *content << endl;
+    else
+      cout << "(NULL)" << endl;
+  }
+};
+
+int main ()
+{
+  TComplicated c = "Hello, world!";
+  TComplicated d = move (c);
+  c.print ();
+  d.print ();
+  return 0;
+}
diff --git a/20230427/r-value-references-05.cpp b/20230427/r-value-references-05.cpp
new file mode 100644
index 0000000..cd82834
--- /dev/null
+++ b/20230427/r-value-references-05.cpp
@@ -0,0 +1,60 @@
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+const bool something_really_complicated = true;
+
+class TComplicated
+{
+  string *content;
+
+public:
+  TComplicated ()
+  {
+    content = NULL;
+  }
+
+  TComplicated (const char *content)
+  {
+    this->content = new string (content);
+  }
+
+  TComplicated (const TComplicated &src)
+  {
+    if (src.content)
+      this->content = new string (*src.content);
+    else
+      this->content = NULL;
+  }
+
+  ~TComplicated ()
+  {
+    cout << "~TComplicated (): content = ";
+    print ();
+    if (content)
+      delete content;
+    content = NULL;
+  }
+
+  void print ()
+  {
+    if (content)
+      cout << *content << endl;
+    else
+      cout << "(NULL)" << endl;
+  }
+};
+
+int main ()
+{
+  TComplicated d;
+  if (something_really_complicated)
+    {
+      TComplicated c = "Hello, world!";
+      c.print ();
+      d = c;
+    }
+  d.print ();
+  return 0;
+}
diff --git a/20230427/r-value-references-06.cpp b/20230427/r-value-references-06.cpp
new file mode 100644
index 0000000..f5653e3
--- /dev/null
+++ b/20230427/r-value-references-06.cpp
@@ -0,0 +1,69 @@
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+const bool something_really_complicated = true;
+
+class TComplicated
+{
+  string *content;
+
+public:
+  TComplicated ()
+  {
+    content = NULL;
+  }
+
+  TComplicated (const char *content)
+  {
+    this->content = new string (content);
+  }
+
+  TComplicated (const TComplicated &src)
+  {
+    if (src.content)
+      this->content = new string (*src.content);
+    else
+      this->content = NULL;
+  }
+
+  ~TComplicated ()
+  {
+    cout << "~TComplicated (): content = ";
+    print ();
+    if (content)
+      delete content;
+    content = NULL;
+  }
+
+  TComplicated &operator = (const TComplicated &src)
+  {
+    if (src.content)
+      this->content = new string (*src.content);
+    else
+      this->content = NULL;
+    return *this;
+  }
+
+  void print ()
+  {
+    if (content)
+      cout << *content << endl;
+    else
+      cout << "(NULL)" << endl;
+  }
+};
+
+int main ()
+{
+  TComplicated d;
+  if (something_really_complicated)
+    {
+      TComplicated c = "Hello, world!";
+      c.print ();
+      d = c;
+    }
+  d.print ();
+  return 0;
+}
diff --git a/20230427/r-value-references-07.cpp b/20230427/r-value-references-07.cpp
new file mode 100644
index 0000000..690be43
--- /dev/null
+++ b/20230427/r-value-references-07.cpp
@@ -0,0 +1,69 @@
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+const bool something_really_complicated = true;
+
+class TComplicated
+{
+  string *content;
+
+public:
+  TComplicated ()
+  {
+    content = NULL;
+  }
+
+  TComplicated (const char *content)
+  {
+    this->content = new string (content);
+  }
+
+  TComplicated (const TComplicated &src)
+  {
+    if (src.content)
+      this->content = new string (*src.content);
+    else
+      this->content = NULL;
+  }
+
+  ~TComplicated ()
+  {
+    cout << "~TComplicated (): content = ";
+    print ();
+    if (content)
+      delete content;
+    content = NULL;
+  }
+
+  TComplicated &operator = (const TComplicated &src)
+  {
+    if (src.content)
+      this->content = new string (*src.content);
+    else
+      this->content = NULL;
+    return *this;
+  }
+
+  void print ()
+  {
+    if (content)
+      cout << *content << endl;
+    else
+      cout << "(NULL)" << endl;
+  }
+};
+
+int main ()
+{
+  TComplicated d;
+  if (something_really_complicated)
+    {
+      TComplicated c = "Hello, world!";
+      c.print ();
+      d = move (c);
+    }
+  d.print ();
+  return 0;
+}
diff --git a/20230427/r-value-references-08.cpp b/20230427/r-value-references-08.cpp
new file mode 100644
index 0000000..7a6de90
--- /dev/null
+++ b/20230427/r-value-references-08.cpp
@@ -0,0 +1,76 @@
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+const bool something_really_complicated = true;
+
+class TComplicated
+{
+  string *content;
+
+public:
+  TComplicated ()
+  {
+    content = NULL;
+  }
+
+  TComplicated (const char *content)
+  {
+    this->content = new string (content);
+  }
+
+  TComplicated (const TComplicated &src)
+  {
+    if (src.content)
+      this->content = new string (*src.content);
+    else
+      this->content = NULL;
+  }
+
+  ~TComplicated ()
+  {
+    cout << "~TComplicated (): content = ";
+    print ();
+    if (content)
+      delete content;
+    content = NULL;
+  }
+
+  TComplicated &operator = (const TComplicated &src)
+  {
+    if (src.content)
+      this->content = new string (*src.content);
+    else
+      this->content = NULL;
+    return *this;
+  }
+
+  TComplicated &operator = (TComplicated &&src)
+  {
+    this->content = src.content;
+    src.content = NULL;
+    return *this;
+  }
+
+  void print ()
+  {
+    if (content)
+      cout << *content << endl;
+    else
+      cout << "(NULL)" << endl;
+  }
+};
+
+int main ()
+{
+  TComplicated d;
+  if (something_really_complicated)
+    {
+      TComplicated c = "Hello, world!";
+      c.print ();
+      d = move (c);
+    }
+  d.print ();
+  return 0;
+}
diff --git a/20230427/r-value-references-09.cpp b/20230427/r-value-references-09.cpp
new file mode 100644
index 0000000..fba9c1c
--- /dev/null
+++ b/20230427/r-value-references-09.cpp
@@ -0,0 +1,76 @@
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+const bool something_really_complicated = true;
+
+class TComplicated
+{
+  string *content;
+
+public:
+  TComplicated ()
+  {
+    content = NULL;
+  }
+
+  TComplicated (const char *content)
+  {
+    this->content = new string (content);
+  }
+
+  TComplicated (const TComplicated &src)
+  {
+    if (src.content)
+      this->content = new string (*src.content);
+    else
+      this->content = NULL;
+  }
+
+  ~TComplicated ()
+  {
+    cout << "~TComplicated (): content = ";
+    print ();
+    if (content)
+      delete content;
+    content = NULL;
+  }
+
+  TComplicated &operator = (const TComplicated &src)
+  {
+    if (src.content)
+      this->content = new string (*src.content);
+    else
+      this->content = NULL;
+    return *this;
+  }
+
+  TComplicated &operator = (TComplicated &&src)
+  {
+    this->content = src.content;
+    src.content = NULL;
+    return *this;
+  }
+
+  void print ()
+  {
+    if (content)
+      cout << *content << endl;
+    else
+      cout << "(NULL)" << endl;
+  }
+};
+
+int main ()
+{
+  TComplicated d;
+  if (something_really_complicated)
+    {
+      TComplicated c = "Hello, world!";
+      c.print ();
+      d = c;
+    }
+  d.print ();
+  return 0;
+}
diff --git a/20230427/r-value-references-10.cpp b/20230427/r-value-references-10.cpp
new file mode 100644
index 0000000..bab07b5
--- /dev/null
+++ b/20230427/r-value-references-10.cpp
@@ -0,0 +1,76 @@
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+const bool something_really_complicated = true;
+
+class TComplicated
+{
+  string *content;
+
+public:
+  TComplicated ()
+  {
+    content = NULL;
+  }
+
+  TComplicated (const char *content)
+  {
+    this->content = new string (content);
+  }
+
+  TComplicated (const TComplicated &src)
+  {
+    if (src.content)
+      this->content = new string (*src.content);
+    else
+      this->content = NULL;
+  }
+
+  ~TComplicated ()
+  {
+    cout << "~TComplicated (): content = ";
+    print ();
+    if (content)
+      delete content;
+    content = NULL;
+  }
+
+  TComplicated &operator = (const TComplicated &src)
+  {
+    if (src.content)
+      this->content = new string (*src.content);
+    else
+      this->content = NULL;
+    return *this;
+  }
+
+  TComplicated &operator = (TComplicated &&src)
+  {
+    this->content = src.content;
+    src.content = NULL;
+    return *this;
+  }
+
+  void print ()
+  {
+    if (content)
+      cout << *content << endl;
+    else
+      cout << "(NULL)" << endl;
+  }
+};
+
+int main ()
+{
+  TComplicated d;
+  if (something_really_complicated)
+    {
+      TComplicated c = "Hello, world!";
+      c.print ();
+      d = (TComplicated &&) c;
+    }
+  d.print ();
+  return 0;
+}
diff --git a/20230427/r-value-references-11.cpp b/20230427/r-value-references-11.cpp
new file mode 100644
index 0000000..253e754
--- /dev/null
+++ b/20230427/r-value-references-11.cpp
@@ -0,0 +1,77 @@
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+const bool something_really_complicated = true;
+
+class TComplicated
+{
+  string *content;
+
+public:
+  TComplicated ()
+  {
+    content = NULL;
+  }
+
+  TComplicated (const char *content)
+  {
+    this->content = new string (content);
+  }
+
+  TComplicated (const TComplicated &src)
+  {
+    if (src.content)
+      this->content = new string (*src.content);
+    else
+      this->content = NULL;
+  }
+
+  ~TComplicated ()
+  {
+    cout << "~TComplicated (): content = ";
+    print ();
+    if (content)
+      delete content;
+    content = NULL;
+  }
+
+  TComplicated &operator = (const TComplicated &src)
+  {
+    if (src.content)
+      this->content = new string (*src.content);
+    else
+      this->content = NULL;
+    return *this;
+  }
+
+  void move (TComplicated &src)
+  {
+    if (content)
+      delete content;
+    this->content = src.content;
+    src.content = NULL;
+  }
+
+  void print ()
+  {
+    if (content)
+      cout << *content << endl;
+    else
+      cout << "(NULL)" << endl;
+  }
+};
+
+int main ()
+{
+  TComplicated d;
+  if (something_really_complicated)
+    {
+      TComplicated c = "Hello, world!";
+      c.print ();
+      d.move (c);
+    }
+  d.print ();
+  return 0;
+}
diff --git a/20230427/r-value-references-12.cpp b/20230427/r-value-references-12.cpp
new file mode 100644
index 0000000..44524f7
--- /dev/null
+++ b/20230427/r-value-references-12.cpp
@@ -0,0 +1,83 @@
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+const bool something_really_complicated = true;
+
+class TComplicated
+{
+  string *content;
+
+public:
+  TComplicated ()
+  {
+    content = NULL;
+  }
+
+  TComplicated (const char *content)
+  {
+    this->content = new string (content);
+  }
+
+  TComplicated (const TComplicated &src)
+  {
+    if (src.content)
+      this->content = new string (*src.content);
+    else
+      this->content = NULL;
+  }
+
+  ~TComplicated ()
+  {
+    cout << "~TComplicated (): content = ";
+    print ();
+    if (content)
+      delete content;
+    content = NULL;
+  }
+
+  TComplicated &operator = (const TComplicated &src)
+  {
+    if (src.content)
+      this->content = new string (*src.content);
+    else
+      this->content = NULL;
+    return *this;
+  }
+
+  string *purge_content ()
+  {
+    string *save_content = content;
+    content = NULL;
+    return save_content;
+  }
+
+  void move (TComplicated &src)
+  {
+    if (content)
+      delete content;
+    this->content = src.purge_content ();
+  }
+
+  void print ()
+  {
+    if (content)
+      cout << *content << endl;
+    else
+      cout << "(NULL)" << endl;
+  }
+};
+
+int main ()
+{
+  TComplicated d;
+  if (something_really_complicated)
+    {
+      TComplicated c = "Hello, world!";
+      c.print ();
+      d.move (c);
+    }
+  d.print ();
+  return 0;
+}
diff --git a/20230427/type-conversions-01.cpp b/20230427/type-conversions-01.cpp
new file mode 100644
index 0000000..f861606
--- /dev/null
+++ b/20230427/type-conversions-01.cpp
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include <stdint.h>
+#include <inttypes.h>
+
+int main ()
+{
+  const char *hello = "Hello, world!";
+  uint64_t address = (uint64_t) hello;
+  printf ("%" PRIx64 "\n", address);
+  return 0;
+}
diff --git a/20230427/type-conversions-02.cpp b/20230427/type-conversions-02.cpp
new file mode 100644
index 0000000..be702cc
--- /dev/null
+++ b/20230427/type-conversions-02.cpp
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include <stdint.h>
+#include <inttypes.h>
+
+int main ()
+{
+  const char *hello = "Hello, world!";
+  uint64_t address = uint64_t (hello);
+  printf ("%" PRIx64 "\n", address);
+  return 0;
+}
diff --git a/20230427/type-conversions-03.cpp b/20230427/type-conversions-03.cpp
new file mode 100644
index 0000000..3457293
--- /dev/null
+++ b/20230427/type-conversions-03.cpp
@@ -0,0 +1,24 @@
+#include <stdio.h>
+
+struct TBase
+{
+  virtual void print ()
+  {
+    printf ("(Base)\n");
+  }
+};
+
+struct THello: public TBase
+{
+  virtual void print ()
+  {
+    printf ("Hello, world!\n");
+  }
+};
+
+int main ()
+{
+  TBase *p = new THello;
+  p->print ();
+  return 0;
+}
diff --git a/20230427/type-conversions-04.cpp b/20230427/type-conversions-04.cpp
new file mode 100644
index 0000000..e21b9c1
--- /dev/null
+++ b/20230427/type-conversions-04.cpp
@@ -0,0 +1,24 @@
+#include <stdio.h>
+
+struct TBase
+{
+  void print ()
+  {
+    printf ("(Base)\n");
+  }
+};
+
+struct THello: public TBase
+{
+  void print ()
+  {
+    printf ("Hello, world!\n");
+  }
+};
+
+int main ()
+{
+  TBase *p = new THello;
+  p->print ();
+  return 0;
+}
diff --git a/20230427/type-conversions-05.cpp b/20230427/type-conversions-05.cpp
new file mode 100644
index 0000000..ea77aec
--- /dev/null
+++ b/20230427/type-conversions-05.cpp
@@ -0,0 +1,25 @@
+#include <stdio.h>
+
+struct TBase
+{
+  virtual void print ()
+  {
+    printf ("(Base)\n");
+  }
+};
+
+struct THello: public TBase
+{
+  virtual void print ()
+  {
+    printf ("Hello, world!\n");
+  }
+};
+
+int main ()
+{
+  TBase *p = new THello;
+  THello *q = p;
+  q->print ();
+  return 0;
+}
diff --git a/20230427/type-conversions-06.cpp b/20230427/type-conversions-06.cpp
new file mode 100644
index 0000000..5e96913
--- /dev/null
+++ b/20230427/type-conversions-06.cpp
@@ -0,0 +1,25 @@
+#include <stdio.h>
+
+struct TBase
+{
+  virtual void print ()
+  {
+    printf ("(Base)\n");
+  }
+};
+
+struct THello: public TBase
+{
+  virtual void print ()
+  {
+    printf ("Hello, world!\n");
+  }
+};
+
+int main ()
+{
+  TBase *p = new THello;
+  THello *q = dynamic_cast <THello *> (p);
+  q->print ();
+  return 0;
+}
diff --git a/20230427/type-conversions-07.cpp b/20230427/type-conversions-07.cpp
new file mode 100644
index 0000000..7454be7
--- /dev/null
+++ b/20230427/type-conversions-07.cpp
@@ -0,0 +1,25 @@
+#include <stdio.h>
+
+struct TBase
+{
+  virtual void print ()
+  {
+    printf ("(Base)\n");
+  }
+};
+
+struct THello: public TBase
+{
+  virtual void print ()
+  {
+    printf ("Hello, world!\n");
+  }
+};
+
+int main ()
+{
+  TBase *p = new TBase;
+  THello *q = dynamic_cast <THello *> (p);
+  q->print ();
+  return 0;
+}
diff --git a/20230427/type-conversions-08.cpp b/20230427/type-conversions-08.cpp
new file mode 100644
index 0000000..c01ddcc
--- /dev/null
+++ b/20230427/type-conversions-08.cpp
@@ -0,0 +1,28 @@
+#include <stdio.h>
+
+struct TBase
+{
+  virtual void print ()
+  {
+    printf ("(Base)\n");
+  }
+};
+
+struct THello: public TBase
+{
+  virtual void print ()
+  {
+    printf ("Hello, world!\n");
+  }
+};
+
+int main ()
+{
+  TBase *p = new TBase;
+  THello *q = dynamic_cast <THello *> (p);
+  if (q)
+    q->print ();
+  else
+    printf ("Typumwandlung fehlgeschlagen.\n");
+  return 0;
+}
diff --git a/20230427/type-conversions-09.cpp b/20230427/type-conversions-09.cpp
new file mode 100644
index 0000000..4aebad7
--- /dev/null
+++ b/20230427/type-conversions-09.cpp
@@ -0,0 +1,28 @@
+#include <stdio.h>
+
+struct TBase
+{
+  virtual void print ()
+  {
+    printf ("(Base)\n");
+  }
+};
+
+struct THello: public TBase
+{
+  virtual void print ()
+  {
+    printf ("Hello, world!\n");
+  }
+};
+
+int main ()
+{
+  TBase *p = new THello;
+  THello *q = dynamic_cast <THello *> (p);
+  if (q)
+    q->print ();
+  else
+    printf ("Typumwandlung fehlgeschlagen.\n");
+  return 0;
+}
diff --git a/20230427/type-conversions-10.cpp b/20230427/type-conversions-10.cpp
new file mode 100644
index 0000000..416aa6e
--- /dev/null
+++ b/20230427/type-conversions-10.cpp
@@ -0,0 +1,28 @@
+#include <stdio.h>
+
+struct TBase
+{
+  virtual void print ()
+  {
+    printf ("(Base)\n");
+  }
+};
+
+struct THello: public TBase
+{
+  virtual void print ()
+  {
+    printf ("Hello, world!\n");
+  }
+};
+
+int main ()
+{
+  TBase *p = new THello;
+  THello *q = static_cast <THello *> (p);
+  if (q)
+    q->print ();
+  else
+    printf ("Typumwandlung fehlgeschlagen.\n");
+  return 0;
+}
diff --git a/20230427/type-conversions-11.cpp b/20230427/type-conversions-11.cpp
new file mode 100644
index 0000000..a92b6bb
--- /dev/null
+++ b/20230427/type-conversions-11.cpp
@@ -0,0 +1,28 @@
+#include <stdio.h>
+
+struct TBase
+{
+  virtual void print ()
+  {
+    printf ("(Base)\n");
+  }
+};
+
+struct THello: public TBase
+{
+  virtual void print ()
+  {
+    printf ("Hello, world!\n");
+  }
+};
+
+int main ()
+{
+  TBase *p = new TBase;
+  THello *q = static_cast <THello *> (p);
+  if (q)
+    q->print ();
+  else
+    printf ("Typumwandlung fehlgeschlagen.\n");
+  return 0;
+}
diff --git a/20230427/type-conversions-12.cpp b/20230427/type-conversions-12.cpp
new file mode 100644
index 0000000..bce43d1
--- /dev/null
+++ b/20230427/type-conversions-12.cpp
@@ -0,0 +1,29 @@
+#include <stdio.h>
+
+struct TBase
+{
+  virtual void print ()
+  {
+    printf ("(Base)\n");
+  }
+};
+
+struct THello: public TBase
+{
+  virtual void print ()
+  {
+    printf ("Hello, world!\n");
+  }
+};
+
+int main ()
+{
+  int answer = 13;
+  int *p = &answer;
+  THello *q = static_cast <THello *> (p);
+  if (q)
+    q->print ();
+  else
+    printf ("Typumwandlung fehlgeschlagen.\n");
+  return 0;
+}
diff --git a/20230427/type-conversions-13.cpp b/20230427/type-conversions-13.cpp
new file mode 100644
index 0000000..50a04d3
--- /dev/null
+++ b/20230427/type-conversions-13.cpp
@@ -0,0 +1,29 @@
+#include <stdio.h>
+
+struct TBase
+{
+  virtual void print ()
+  {
+    printf ("(Base)\n");
+  }
+};
+
+struct THello: public TBase
+{
+  virtual void print ()
+  {
+    printf ("Hello, world!\n");
+  }
+};
+
+int main ()
+{
+  int answer = 13;
+  int *p = &answer;
+  THello *q = (THello *) p;
+  if (q)
+    q->print ();
+  else
+    printf ("Typumwandlung fehlgeschlagen.\n");
+  return 0;
+}
diff --git a/20230427/type-conversions-14.cpp b/20230427/type-conversions-14.cpp
new file mode 100644
index 0000000..a9ed970
--- /dev/null
+++ b/20230427/type-conversions-14.cpp
@@ -0,0 +1,31 @@
+#include <stdio.h>
+
+struct TBase
+{
+  virtual void print ()
+  {
+    printf ("(Base)\n");
+  }
+};
+
+struct THello: public TBase
+{
+  const char *content;
+
+  THello (const char *s)
+  {
+    content = s;
+  }
+
+  virtual void print ()
+  {
+    printf ("%s\n", content);
+  }
+};
+
+int main ()
+{
+  THello h = "Hello, world!";
+  h.print ();
+  return 0;
+}
diff --git a/20230427/type-conversions-15.cpp b/20230427/type-conversions-15.cpp
new file mode 100644
index 0000000..17fa8b5
--- /dev/null
+++ b/20230427/type-conversions-15.cpp
@@ -0,0 +1,37 @@
+#include <stdio.h>
+
+struct TBase
+{
+  virtual void print ()
+  {
+    printf ("(Base)\n");
+  }
+};
+
+struct THello: public TBase
+{
+  const char *content;
+
+  THello (const char *s)
+  {
+    content = s;
+  }
+
+  THello (const TBase &b)
+  {
+    content = "(Base)";
+  }
+
+  virtual void print ()
+  {
+    printf ("%s\n", content);
+  }
+};
+
+int main ()
+{
+  TBase b;
+  THello h = b;
+  h.print ();
+  return 0;
+}
diff --git a/20230427/type-conversions-16.cpp b/20230427/type-conversions-16.cpp
new file mode 100644
index 0000000..761cda5
--- /dev/null
+++ b/20230427/type-conversions-16.cpp
@@ -0,0 +1,37 @@
+#include <stdio.h>
+
+struct TBase
+{
+  virtual void print ()
+  {
+    printf ("(Base)\n");
+  }
+};
+
+struct THello: public TBase
+{
+  const char *content;
+
+  THello (const char *s)
+  {
+    content = s;
+  }
+
+  explicit THello (const TBase &b)
+  {
+    content = "(Base)";
+  }
+
+  virtual void print ()
+  {
+    printf ("%s\n", content);
+  }
+};
+
+int main ()
+{
+  TBase b;
+  THello h = b;
+  h.print ();
+  return 0;
+}
diff --git a/20230427/type-conversions-17.cpp b/20230427/type-conversions-17.cpp
new file mode 100644
index 0000000..7f51b7f
--- /dev/null
+++ b/20230427/type-conversions-17.cpp
@@ -0,0 +1,37 @@
+#include <stdio.h>
+
+struct TBase
+{
+  virtual void print ()
+  {
+    printf ("(Base)\n");
+  }
+};
+
+struct THello: public TBase
+{
+  const char *content;
+
+  THello (const char *s)
+  {
+    content = s;
+  }
+
+  explicit THello (const TBase &b)
+  {
+    content = "(Base)";
+  }
+
+  virtual void print ()
+  {
+    printf ("%s\n", content);
+  }
+};
+
+int main ()
+{
+  TBase b;
+  THello h (b);
+  h.print ();
+  return 0;
+}
diff --git a/20230427/type-conversions-18.cpp b/20230427/type-conversions-18.cpp
new file mode 100644
index 0000000..bfab7be
--- /dev/null
+++ b/20230427/type-conversions-18.cpp
@@ -0,0 +1,41 @@
+#include <stdio.h>
+
+struct TBase
+{
+  virtual void print ()
+  {
+    printf ("(Base)\n");
+  }
+};
+
+struct THello: public TBase
+{
+  const char *content;
+
+  THello (const char *s)
+  {
+    content = s;
+  }
+
+  THello (const TBase &b)
+  {
+    content = "(Base)";
+  }
+
+  virtual void print ()
+  {
+    printf ("%s\n", content);
+  }
+};
+
+void print_it (const THello &h)
+{
+  printf ("%s\n", h.content);
+}
+
+int main ()
+{
+  TBase b;
+  print_it (b);
+  return 0;
+}
diff --git a/20230427/type-conversions-19.cpp b/20230427/type-conversions-19.cpp
new file mode 100644
index 0000000..32fe3fb
--- /dev/null
+++ b/20230427/type-conversions-19.cpp
@@ -0,0 +1,41 @@
+#include <stdio.h>
+
+struct TBase
+{
+  virtual void print ()
+  {
+    printf ("(Base)\n");
+  }
+};
+
+struct THello: public TBase
+{
+  const char *content;
+
+  THello (const char *s)
+  {
+    content = s;
+  }
+
+  explicit THello (const TBase &b)
+  {
+    content = "(Base)";
+  }
+
+  virtual void print ()
+  {
+    printf ("%s\n", content);
+  }
+};
+
+void print_it (const THello &h)
+{
+  printf ("%s\n", h.content);
+}
+
+int main ()
+{
+  TBase b;
+  print_it (b);
+  return 0;
+}
diff --git a/20230427/type-conversions-20.cpp b/20230427/type-conversions-20.cpp
new file mode 100644
index 0000000..cc5055d
--- /dev/null
+++ b/20230427/type-conversions-20.cpp
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+int main ()
+{
+  int answer = 1117;
+  int *p = &answer;
+  printf ("The address of the answer is: %zx\n", p);
+  return 0;
+}
diff --git a/20230427/type-conversions-21.cpp b/20230427/type-conversions-21.cpp
new file mode 100644
index 0000000..48cbdb9
--- /dev/null
+++ b/20230427/type-conversions-21.cpp
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+int main ()
+{
+  int answer = 1117;
+  int *p = &answer;
+  printf ("The address of the answer is: %zx\n", (size_t) p);
+  return 0;
+}
diff --git a/20230427/type-conversions-22.cpp b/20230427/type-conversions-22.cpp
new file mode 100644
index 0000000..592c47f
--- /dev/null
+++ b/20230427/type-conversions-22.cpp
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+int main ()
+{
+  int answer = 1117;
+  int *p = &answer;
+  printf ("The address of the answer is: %zx\n", reinterpret_cast <size_t> (p));
+  return 0;
+}
diff --git a/20230427/type-conversions-23.cpp b/20230427/type-conversions-23.cpp
new file mode 100644
index 0000000..45d2aeb
--- /dev/null
+++ b/20230427/type-conversions-23.cpp
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+int main ()
+{
+  const char* hello = "Hello, world!";
+  char *h = hello;
+  printf ("%s\n", h);
+  return 0;
+}
diff --git a/20230427/type-conversions-24.cpp b/20230427/type-conversions-24.cpp
new file mode 100644
index 0000000..889b4d5
--- /dev/null
+++ b/20230427/type-conversions-24.cpp
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+int main ()
+{
+  const char* hello = "Hello, world!";
+  char *h = (char *) hello;
+  printf ("%s\n", h);
+  return 0;
+}
diff --git a/20230427/type-conversions-25.cpp b/20230427/type-conversions-25.cpp
new file mode 100644
index 0000000..fdb8227
--- /dev/null
+++ b/20230427/type-conversions-25.cpp
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+int main ()
+{
+  const char* hello = "Hello, world!";
+  char *h = const_cast <char *> (hello);
+  printf ("%s\n", h);
+  return 0;
+}
-- 
GitLab