title: How do I convert vector of strings into vector of integers in C++?
body: <p>I have a vector of strings. Need help figuring out how to convert it into vector of integers in order to be able to work with it arithmetically. Thanks!</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;vector&gt;
  using namespace std;
  
  int main(int argc, char* argv[]) {
  
      vector&lt;string&gt; vectorOfStrings;
      vectorOfStrings.push_back("1");
      vectorOfStrings.push_back("2");
      vectorOfStrings.push_back("3");
  
      for (int i=0; i&lt;vectorOfStrings.size(); i++)
      {
          cout&lt;&lt;vectorOfStrings.at(i)&lt;&lt;endl;
      }
  
      vector&lt;int&gt; vectorOfIntegers;
  
      //HELP NEEDED HERE
      //CONVERSION CODE from vector&lt;string&gt; to vector&lt;int&gt; 
  
      int sum;
      for (int i=0; i&lt;vectorOfIntegers.size(); i++)
      {
          sum += vectorOfIntegers.at(i);
      }
      cout&lt;&lt;sum&lt;&lt;endl;
      cin.get();
  
      return 0;
  }
  </code></pre>