title: How to calculate sin and cos off all vector elements?
body: <p>My code</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;algorithm&gt;
  #include &lt;vector&gt;
  #include &lt;iterator&gt;
  #include &lt;sstream&gt;
  #include &lt;cmath&gt;
  
  #define PI 3.14159265
  
  int main(){
      std::ifstream ifs("MFSO7.dat");
      std::string line;
  
  std::vector&lt;float&gt; column1;
  std::vector&lt;float&gt; column2;
  std::vector&lt;float&gt; column3;
  std::vector&lt;float&gt; vkos;
  std::vector&lt;float&gt; vsin;
  
  while(std::getline(ifs, line)) // read one line from ifs
  {
      std::istringstream iss(line); // access line as a stream
      float item1;
      float item2;
      float item3;
  
      // Read the items from the line
      iss &gt;&gt; item1 &gt;&gt; item2 &gt;&gt; item3;
  
      // Add them to the columns.
      column1.push_back(item1);
      column2.push_back(item2);
      column3.push_back(item3);
  
  }
  
  for(int i=0;i&lt;38;i++)
  {
  vkos[i]=cos(column3[i]* PI/180.0 );
  vsin[i]=sin(column3[i]* PI/180.0 );
  }
  
  std::cout &lt;&lt; vkos[1] &lt;&lt; std::endl;
  
  }
  </code></pre>
  
  <p>Whem I execute the code I got</p>
  
  <pre><code>milenko@milenko-X58-USB3:~/Calibration Files$ ./a1
  Segmentation fault (core dumped)
  </code></pre>
  
  <p>Why?May be I should avoid the loop or...?</p>