sichtbar machen

Dependencies:   mbed

Revision:
1:18c470c81ce5
diff -r e0dea4ed78aa -r 18c470c81ce5 beispiel_fur_exceptionklassen/main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/beispiel_fur_exceptionklassen/main.cpp	Tue Apr 21 18:37:00 2020 +0000
@@ -0,0 +1,30 @@
+#include "exception.h"
+#include <iostream>
+
+using std::cout;
+using std::endl;
+using std::cin;
+
+int main(int argc, char const *argv[])
+{
+  int number;
+  std::string input;
+  const std::string bb;
+  cout << "let's begin with exceptions" << endl;
+  cout << "write a number, which is not even and greater than 23: ";
+  try
+  {
+      cin >> number;
+      if (!(number % 2))
+      {
+        throw myexceptions(myexceptions::Error_Type::EVEN);
+      }
+      if(number < 23)
+        throw myexceptions(myexceptions::Error_Type::TOO_SMALL);
+  }
+  catch(const myexceptions& e)
+  {
+    std::cerr << e.what() << '\n';
+  }
+  return 0;
+}
\ No newline at end of file