title: change variable name with a loop
body: <p>Is there a way without using arrays to write the following with a loop:</p>
  
  <pre><code>cout&lt;&lt;"This variable c1 ="c1
  cout&lt;&lt;"This variable c2 ="c2
  cout&lt;&lt;"This variable c3 ="c3
  
  for(i=1,i&lt;8,i++)
  cout&lt;&lt;"This variable c%d =",i&lt;&lt;**????**&lt;&lt;
  </code></pre>
  
  <p>This is obviously not what I Need to be done but is the easiest example I could think of with the same problem...
  So what I would like to do is change the variables in the loop, not the output!</p>
  
  <p>EDIT:
  Thanks a lot for all the input,
  here is a bit more of the code to help illustrate my problem...Im Using Cplex with c++.
  The loop will not end at seven but when a stop criteria is met</p>
  
  <pre><code>static void  populatebyrow (IloModel model, IloNumVarArray x, IloRangeArray c)
  {
      IloExpr c1(env);
      IloExpr c2(env);
      IloExpr c3(env);
      IloExpr c4(env);
  
      c.add(c1&gt;=n);
      c.add(c2&gt;=n); ...
  
      model.add(c);
  }
  </code></pre>
  
  <p>I Want to add  these expressions to an Array called c that will be an input for a model in cplex.
  Then after I get a result from Cplex I want to add an expression c(i) and solve it again...
  This until i get the values I want...
  IloExprArray could also be used somehow, but then I dont know how to add the expressions using this method:</p>
  
  <pre><code>for(i= 0,...)
  {
      c7 +=x[i];
  }
  </code></pre>