ILOG CPLEX 11.0 Getting Started > Tutorials > Concert Technology Tutorial for C++ Users > The Anatomy of an ILOG Concert Technology C++ Application > Querying Results

After successfully solving the optimization problem, you probably are interested in accessing the solution. The following methods can be used to query the solution value for a variable or a set of variables:

IloNum IloCplex::getValue(IloNumVar var) const;
void IloCplex::getValues(IloNumArray val,
                         const IloNumVarArray var) const;

For example:

IloNum val1 = cplex.getValue(x1);

stores the solution value for the modeling variable x1 in val1. Other methods are available for querying other solution information. For example, the objective function value of the solution can be accessed using:

IloNum objval = cplex.getObjValue();