How to handle exceptions in c++?
Example:
int main() {
int x = 10 / 0;
}
Solution:
#include
int main() {
try {
int x = 10 / 0;
} catch(const std::exception& e) {
std::cout << e.what() << std::endl;
}
}