Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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; }