MCPcopy Create free account
hub / github.com/ShivaBhattacharjee/KeyZen / safe_divide

Function safe_divide

data/cpp/06_error_handling.cpp:17–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15}
16
17int safe_divide(int a, int b) {
18 if (b == 0) {
19 throw std::invalid_argument("division by zero");
20 }
21 return a / b;
22}
23
24int main() {
25 try {

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected