Shows how to use argument_exception exception.
#include <xtd/argument_exception>
#include <xtd/console>
int divide_by_two(int num) {
return num / 2;
}
auto main() -> int {
console::write_line("10 divided by 2 is {0}", divide_by_two(10));
try {
console::write_line("7 divided by 2 is {0}", divide_by_two(7));
console::write_line("7 is not divided by 2 integrally.");
}
}
The exception that is thrown when one of the arguments provided to a method is not valid.
Definition argument_exception.hpp:24
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10