title: Runge-Kutta method on c++
body: <p>i'm trying to code a simple runge-kutta method </p>
  
  <p>The function to be approximated and the runge-kutta method are separate definitions, which are called within the loop in the main function.</p>
  
  <p>approximate solutions for y and t are pushed into a separate vectors.</p>
  
  <p>I'm receiving the following errors and struggling to figure out why:
  <a href="https://i.stack.imgur.com/0dx5H.png" rel="nofollow noreferrer">Error message snapshot</a></p>
  
  <p>The code:</p>
  
  <pre><code>//Runge Kutta
  #include "C:\Users\Erez\Documents\Dev C++ Projects\std_lib_facilities.h"
  
  double f (double t,double y){ 
     f = t + y;
  return f;
  }
  
  double rk4funct (double t,double y,double d){
    double k1, k2, k3, k4;
    k1 = d * f(t, y);
    k2 = d * f(t+0.5*d, y+0.5*k1);
    k3 = d * f(t+0.5*d, y+0.5*k2);
    k4 = d * f(t+d, y+k3);
  return k1, k2, k3, k4;
  }
  
  int main (){
  
    vector&lt;double&gt; yvector;
    vector&lt;double&gt; tvector;
    double y0 {0}; //initial y value
    double t0 {0}; //initial time value
    double d {0}; //step size
    int n {0}; //number of iterations
  
    cout &lt;&lt; "Please input variables according to the following order: step size, y0, t0, n(# of iterations)\n";
    cin &gt;&gt; d &gt;&gt; y0 &gt;&gt; t0 &gt;&gt; n;
    yvector.push_back(y0);
    tvector.push_back(t0);
  
  
      for (int i {0}; i&lt;n; ++i;) {
        rk4funct (tvector[i], yvector[i], d); 
        yvector[i+1] = yvector[i] + (d/6)*(k1+2k2+2k3+k4); 
        tvector[i+1] = tvector[i] + d; //same here.
      }
  
  }
  </code></pre>