debugging
assert(x > 0); // Check if x is greater than 0, else terminate with an assertion error messagetry {
// Code that may throw an exception
} catch (const std::exception& e) {
std::cerr << "Exception: " << e.what() << std::endl;
}std::cerr << "Error: " << errorMessage << std::endl;std::cout << "Debug: " << debugMessage << std::endl;std::ofstream logFile("debug.log");
logFile << "Debug: " << debugMessage << std::endl;// Set breakpoints at specific lines using `gdb --args ./a.out`
(gdb) break 15