#include <iostream> class DivisionByZero {}; float dezimal(int zaehler, int nenner) { if (nenner == 0) throw DivisionByZero(); return float(zaehler) / nenner; } int main() { char const* const prompt = "Eingabe Zaehler Nenner: "; int z, n; while (std::cout << prompt && cin >> z >> n) { try { float bruch = dezimal(z, n); std::cout << "Dezimalbruch = " << bruch << '\n'; } catch(DivisionByZero& error) { std::cerr << "Nenner darf nicht Null sein!" << '\n'; } } }