import std;
using std::nullopt;
using std::optional;
constexpr optional<double> divide(double x, double y) noexcept {
if (y != 0.0) {
return x / y;
}
return nullopt;
}
void readDivisionResults(int x, int y) {
optional<double> result = divide(x, y);
if (result) {
std::println("The quotient of x: {} and y: {} is {}.", x, y, result.value());
} else {
std::println("The quotient of x: {} and y: {} is undefined!", x, y);
}
}
int main(int argc, char* argv[]) {
readDivisionResults(1, 5);
readDivisionResults(8, 0);
}