title: Is there a way to cycle through variables? (C++)
body: <p>I am creating a class with 18 different variables, most of them doubles. I need to declare all of them and also perform the same operation on each of them. Is there any way to use a loop to cycle through all the declarations?
  For example, instead of saying:</p>
  
  <p><code>double a = 0.0;</code></p>
  
  <p><code>double b = 0.0;</code></p>
  
  <p><code>double c = 0.0;</code></p>
  
  <p>...</p>
  
  <p><code>double z = 0.0;</code></p>
  
  <p>Is it possible to loop them like this:</p>
  
  <pre><code>while(variables are undefined)
  
  define the next undefined variable
  
  end loop
  </code></pre>
  
  <p>EDIT: Thank you for the answers, everyone. I didn't want to use an array at first because it would make remembering which element represents what value more difficult. I will look into map, and if that doesn't work I think I found a way to organize the array that I can remember.</p>