title: subtract values from elements in a vector C++
body: <p>I have two vectors with the values</p>
  
  <pre><code>2.123, 2.111, 9.222
  1.22, 4.33, 2.113
  </code></pre>
  
  <p>I want to subtract the first element of each Vector with each other, the second element of each Vector, and the third. so</p>
  
  <pre><code>abs(2.123-1.22)
  abs(2.111-4.33)
  abs(9.222-2.113)
  </code></pre>
  
  <p>I'm pretty sure you have to create a for loop but I'm not sure how to approach this problem as I am new to C++. Thank you all for your help.</p>
  
  <p>The code below is a general concept of what I have</p>
  
  <pre><code>std::vector&lt;double&gt; data1, vector&lt;double&gt; data2, vector&lt;double&gt; result;
  std::cout &lt;&lt; "Enter in data#1 ";
  std::cin &gt;&gt; data1;
  
  std::cout &lt;&lt; "Enter in data#2 ";
  std::cin &gt;&gt; data2;
  
  for (int i=0;i&lt;data1.size();i++){
      //start subtracting the values from each other and have them stored in another Vector
  </code></pre>