sichtbar machen
Dependencies: mbed
beispiel_fur_exceptionklassen/main.cpp
- Committer:
- kafka
- Date:
- 2020-04-21
- Revision:
- 1:18c470c81ce5
File content as of revision 1:18c470c81ce5:
#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; }