Is there a way without using arrays to write the following with a loop:
cout<<"This variable c1 ="c1
cout<<"This variable c2 ="c2
cout<<"This variable c3 ="c3
for(i=1,i<8,i++)
cout<<"This variable c%d =",i<<**????**<<
This is obviously not what I need to do, but it is the simplest example that I could think of with the same problem ... So what I would like to do is change the variables in a loop, not in the output!
EDIT: Thanks so much for all the input, here is a bit more code that will help illustrate my problem ... Im Using Cplex with C ++. The cycle does not end at seven, but when stopping criteria are met
static void populatebyrow (IloModel model, IloNumVarArray x, IloRangeArray c)
{
IloExpr c1(env);
IloExpr c2(env);
IloExpr c3(env);
IloExpr c4(env);
c.add(c1>=n);
c.add(c2>=n); ...
model.add(c);
}
, c, cplex.
, Cplex, c (i) ...
, , ...
IloExprArray - , , , :
for(i= 0,...)
{
c7 +=x[i];
}
user119653