fork download
  1. #include <boost/format.hpp>
  2. #include <string>
  3. #include <stdexcept>
  4. #include <iostream>
  5. int N_size_file = 5000;
  6. int N_MAX = 4500;
  7. void f()
  8. {
  9. if(N_size_file > N_MAX)
  10. throw std::runtime_error( str(boost::format(
  11. "check(): Hidden node count of %d exceeds maximum allowed value of %d ")
  12. % N_size_file % N_MAX));
  13. }
  14. int main()
  15. {
  16. try {
  17. f();
  18. } catch(const std::exception& e) {
  19. std::cout << "Caught exception: " << e.what() << '\n';
  20. }
  21. }
Success #stdin #stdout 0.02s 2896KB
stdin
Standard input is empty
stdout
Caught exception: check(): Hidden node count of 5000 exceeds maximum allowed value of 4500