ILOG CPLEX 11.0 User's Manual > Languages and APIs > ILOG Concert Technology for C++ Users > Example: Optimizing the Diet Problem in C++ > Application Description

In ilodiet.cpp, the main part of the application starts by declaring the environment and terminates by calling the method end for that environment. The code in between is encapsulated in a try block that catches all Concert Technology exceptions and prints them to the C++ error stream cerr. All other exceptions are caught as well, and a simple error message is issued. The first action of the program is to evaluate command-line options and call the function usage in cases of misuse.

Note
In such cases, an exception is thrown. This practice makes sure that env.end is called before the program is terminated.