title: C++- How can I convert a column in Excel to a vector in C++ in the following algorithm?
body: <p>In the following code I want to validate some data. However, I have no clue how to do this with a csv file comma delimiter. If I wanted to replace the vectors vector submitted{5,0,3,4,6,1} and vector expected{0,0,33,50,0,0} with a vector from a csv file with two columns like this:</p>
  
  <p>........submitted....expected</p>
  
  <ol>
  <li>........5................0</li>
  <li>.......0.................0</li>
  <li>.......3................33</li>
  <li>.......4................50</li>
  <li>.......6................0</li>
  <li>.........1............0</li>
  </ol>
  
  <p>so basically i want to get my vector from a csv file... where column submitted is my first vector and expected column is my second vector. I want to work with more data and place it in my csv file and then convert it into a vector and replace the submitted and expected from the code below to a vector with a vector from my csv file. is there any way to do this?</p>
  
  <p>int main() {</p>
  
  <pre><code>vector&lt;int&gt; result;
  vector &lt;string&gt; validate;
  vector&lt;int&gt; submitted{5,0,3,4,6,1};
  vector&lt;int&gt; expected{0,0,33,50,0,0};
  
  for (int j = 0; j &lt; submitted.size(); j++) {
  
  
      for (int i = 0; i &lt;= submitted[j]; i++) {
  
          if (round(((1.0 / submitted[j]) * i) * 100) == expected[j]) {
              validate.push_back("passed");
              result.push_back(round(((1.0 / submitted[j]) * i) * 100));
              cout &lt;&lt; " Result: " &lt;&lt; result[j]&lt;&lt;" Expected : " &lt;&lt; expected[j]&lt;&lt; " Status: "&lt;&lt; validate[j]&lt;&lt;endl;
              break;
  
          }
          //if the next greater number than expected, give the last plausible integer
          else if (round(((1.0 / submitted[j]) * (i+1)) * 100) &gt; expected[j]&amp;&amp;expected[j]!=0&amp;&amp;submitted[j]!=0) {
              validate.push_back("failed");
              result.push_back(round(((1.0 / submitted[j]) * i) * 100));
              cout &lt;&lt; " Result: " &lt;&lt; result[j] &lt;&lt; " Expected : " &lt;&lt; expected[j] &lt;&lt; " Status: " &lt;&lt; validate[j]&lt;&lt;endl;
              break;
  
          }
          else if (expected[j] == 0||submitted[j]==0) {
              validate.push_back("failed");
              result.push_back(0);
              cout &lt;&lt; " Result: " &lt;&lt; 0 &lt;&lt; " Expected : " &lt;&lt; 0 &lt;&lt; " Status: " &lt;&lt; " passed " &lt;&lt; endl;
              break;
          }
  
  
  
  
      }
  
  }
  
  
  return 0;
  </code></pre>