title: Selecting member of a struct vector with variables c++
body: <p>I have the following situation</p>
  <pre><code>struct EW{
  int date=0;
  float aaa=0;
  float bbb=0;
  float ccc=0;
  float ddd=0;
  float eee=0.0;};
  </code></pre>
  <p>Then I have</p>
  <pre><code>vector &lt;EW&gt; ew;
  string a={};
  float sum=0.0;
  cin&lt;&lt;a;
  for(int i=0;i&lt;ew.size();I++){
  sum +=ew[i].a;}//here error in selecting a
  </code></pre>
  <p>My question is how could I do ew[i].a.
  I don't want to check all struct member to know, just use the variable as the name.</p>
  <p>Hopping it was a clear enough.
  Thanks</p>